Reputation: 93
I want to add the abbility, to edit an existing action with an attribute date which comes from a datePicker. Than I have to assign the date to a datePicker.
How can I assign this date to a datePicker?
Upvotes: 0
Views: 30
Reputation: 2465
Just set the date
property
let picker = UIDatePicker()
let date = Date() // current date
picker.date = date
If you want animation you can do:
let picker = UIDatePicker()
let date = Date()
picker.setDate(date, animated: true)
A good way to solve such problem is to read documentation of UIDatePicker
Upvotes: 2