I'm developing a custom keyboard in Swift and I would like to know when the keyboard type changes (to a number or decimal keyboard type for example). I believe this should be done in either textDidChange
or textWillChange
. This method receives a UITextInput
which has a property keyboardType
. But when this method is called, that property seems to always be nil
because it never runs the following code, even after I have entered a different input type (number).
override func textDidChange(textInput: UITextInput) {
if let inputType = textInput.keyboardType {
//never gets here
deleteKeyboardButton.backgroundColor = UIColor.yellowColor()
}
}