I just gave it a try and here is what I found:
If I get preview "marked text", then cancel I get these calls in this order:
setMarkedText: with "".
setMarkedText: with "some string".
setMarkedText: with "".
unmarkText.
If I hit insert I get these calls in this order:
setMarkedText: with "".
setMarkedText: with "some string".
unmarkText.
setMarkedText: with "".
So if I understand correctly that means that if I receive unmarkText while there is marked text it should be inserted. I gave that a try in my code and it works! Thanks!
Upon re-reading the documentation That now makes sense. I think that if I was actually fully implementing UITextInput I would have figured it out. However since I was only using the methods mentioned in the talk for camera I didn't have the extra context, even after reading the UIKeyInput and UITextInput documentation.
I will update my Feedback with this information, and I think it basically turns into some combination of:
When using the captureTextFromCamera the behavior of UIKeyInput and UITextInput don't make sense, since changing the declared protocol conformance changes the behavior.
The session implies that you can just implement UITextInput to get the marked text (e.g. preview text) behavior without changing the logic from your UIKeyInput conformance for dealing with the "inserted" text.
Topic:
Programming Languages
SubTopic:
Swift
Tags: