dillidon / alerts-and-pickers

Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date...
MIT License
5.65k stars 700 forks source link

How to get date from picker, if opened and closed picker on done event without any changes? #82

Open kagmanoj25 opened 5 years ago

kagmanoj25 commented 5 years ago

Picker does not return any value on done button while we don't select anything and just press done button. If i want to get default selected value on done press event then what should i do?

TayyabAli652 commented 5 years ago

you should set the current date in var like var currentDate = Date() then set that variable to your default label or text. Then when you pick any date from picker then update value of currentDate to picked date like currentDate = pickableDate