I have implemented a complicated UITextInput that works quite well on iOS save for one missing feature:
- when the user has a hardware keyboard connected (at least, in the simulator) and no text is selected, and presses Forward Delete, nothing happens.
Note that I am NOT referring to the key labeled Delete on a Mac, which is just a Backspace key -- that works correctly already, using an implementation of the UIKeyInput deleteBackward method.
Two questions:
Is it possible for iOS to process Forward Delete correctly (for example a Bluetooth Mac hardware keyboard with Fn + Delete aka not Backspace, but Forward Delete). This works on my Mac laptop? (The answer seems like a yes because I just tested Forward Delete on a hardware keyboard (my host Mac dev machine) in the Simulator in Safari.)
If it is possible and common in other apps, how do I intercept this key command? I cannot find what to send as the string to create a UIKeyCommand, nor can I find any API method that makes sense to do this in an easy fashion.
Note also that selecting text and pressing the Forward Delete key works properly already in this custom text editor, so it appears iOS knows about this key.
FYI this code is in C# but answers to part (2) in Swift or Objective-C would be welcome as well.
(My current best guess might be try messing with the code in this question ? -- Seems like a real headache just to get this one fairly common key?)
UPDATE:
Now pressing Delete (right-delete not backspace) somehow works on iOS, at least the simulator. It may have been a bug in the TextInput system since now when I press the right-Delete key, the system calls my code to select a single character to the right of my cursor and then calls my DeleteBackwards code to delete the selection (which code knows how to delete selected text). Strange but happy this is working as expected now, "out of the box".