From mine, Custom KeyboardI would like to know if the user has selected something in his text (and its range). After the documentation, I thought that I could use the callbacks provided by the protocol UITextInputDelegate:
- selectionWillChange (textInput: UITextInput)
- selectionDidChange (textInput: UITextInput)
- textWillChange (textInput: UITextInput)
- textDidChange (textInput: UITextInput)
However, callbacks are selectionWill/DidChangenever called. If I change the selection in the text, other callbacks will be activated ( textWill/DidChange). Since this is already odd, the problem is that the parameter is textInputalways zero. But I need this, because I would like to get access to selectedTextRangesolve my problem.
Any ideas how to extract the selected text and / or its range within a custom keyboard implementation?
source
share