Instead of having to do this complicated work with overriding textFieldShouldBeginEditing
you can just do this somewhere, like in viewDidLoad
:
_birthdateTextField.inputView = _birthdateDatePicker;
And the date picker will replace the keyboard when you go to edit the birthdate text field