Member-only story
Introducing Swift’s New Modern Date Picker
A UI component that was long overdue for a refresh just got one
As revealed at WWDC 2020, Apple has given the Date and Time Picker an Airbnb-style upgrade. Since there isn’t a new name for this Date Picker, let’s just call it the Modern Date Picker.
“Display a calendar date and provide controls for editing the date value.” — Apple’s documentation
Prerequisites
To follow along with this tutorial, you’ll need some basic knowledge in:
- Swift
- At least Xcode 12+
Note: This only supports iOS 14+.
Modern Date Picker
To give you a better picture of the transformation, take one last look at the traditional Date Picker. Now look at the Modern Date Picker with one line of code:
datePicker.preferredDatePickerStyle = .compact

I was wondering how to exit the pop-up once I was done selecting the date and time. I was hoping to see a “Done”…