MohanSingh MohanSingh - 9 months ago 194
iOS Question

How to make a time picker view in swift 3.0?

I successfully make

view over my
in Swift. But I need to time picking in the format of
. I have no idea about it. I need to apply picked time in time
. so, How to make Time Picker in Swift? please refer below image. swift 2.2 , 2.0 answers also okay. Thanks lot friends!

enter image description here


Set the datePickerMode to time

Swift 3

self.datePicker.datePickerMode = .time

Swift 2.3 or lower

self.datePicker.datePickerMode = .Time

Note: This will allow you to only select Hours and Minutes, if you want to select Seconds also you need to go for custom time picker.