I’m trying to set a default time in format HH:mm using a UIDatePicker (not initiated from text fields) for a startTime and endTime. I can’t find an example where this has been done. Any help will be appreciated :))
@IBOutlet weak var startPicker: UIDatePicker!
@IBOutlet weak var endPicker: UIDatePicker!
I can only see minDate and maxDate in xcode which isn’t what I need.
@IBAction func setTime(sender: UIDatePicker) {
let formatter = DateFormatter()
formatter.dateFormat = "HH:mm"
let startPicker = formatter.date(from: "18:00")
let endPicker = formatter.date(from: "6:00")
}
I saw this and tried it but it was still giving me errors. However, I just went ahead and did it manually here as it isn’t rlly vital but wanted to play around with it ahah