'Dismissing the datePicker calendar when selecting a date

I have a problem with the new datePicker update. Whenever I select a date in the calendar, in order to dismiss it, I have to tap anywhere out of the date picker to dismiss it. Is there a way to dismiss the date picker whenever I select a date?



Solution 1:[1]

I assume, you using done press button after selecting date. Just put this code end of your done press like:

func doneButtonPressed() {
 // Your code block

    self.view.endEditing(true)
 // view is your mainView
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1