UIAlertDateTimePicker is a date and time picker in form of an Alert View. Which gives you a feels of a native alert view in iOS.
- Add a pod entry for UIAlertDateTimePicker to your Podfile
pod 'UIAlertDateTimePicker', '~> 1.0' - Install the pod(s) by running
pod install. - Include UIAlertDateTimePicker wherever you need it with
import UIAlertDateTimePicker.
You can setup your UIAlertDateTimePicker in the following ways
UIAlertDateTimePicker(withPickerMode: .dateAndTime, pickerTitle: "Select Date & Time", showPickerOn: self.view)UIAlertDateTimePicker(withPickerMode: .dateAndTime, pickerTitle: "Select Date & Time", minDate: minDate, maxDate: maxDate, showPickerOn: self.view)
Set delegate to receive callbacks of Alert buttons with dates
datePicker.delegate = self
Add Protocol to your class UIAlertDateTimePickerDelegate
The code below will present your UIAlertDateTimePicker on the screen
datePicker.showAlert()

