How to disable keyboard input for UIDatePicker with preferredDatePickerStyle set to .wheels on iOS 15

Currently in Xcode 13 beta 5, if I have a UIDatePicker with the following configuration:

let datePicker = UIDatePicker()
datePicker.preferredDatePickerStyle = .wheels
datePicker.datePickerMode = .dateAndTime

the user can tap the highlighted date or time to bring up the keyboard. This effectively "breaks" a UI (which worked fine pre-iOS 15) in which the date picker is anchored to the bottom of the screen, as the keyboard then covers the entirety of the date picker.

Is there a way to disable keyboard input for a date picker with the wheels style?

Try this datePicker.addTarget(self, action: #selector(handleDatePickerTap), for: .editingDidBegin)

` @objc func handleDatePickerTap() {

        datePicker.resignFirstResponder()

    }
How to disable keyboard input for UIDatePicker with preferredDatePickerStyle set to .wheels on iOS 15
 
 
Q