Description
I'm (trying to) use captureTextFromCamera(sender:)
however I'm having issues getting both insertText(text:)
and setMarkedText(markedText:, selectedRange:)
/unmarkText()
to work at the same time. I have attached the relevant portion of the UIView subclass here:
Details
I subclassed UIView and implemented the relevant methods/properties for UITextInput, however I found that while the markedText methods were being called insertText wasn't.
I then changed my subclass to declare it's conformance to UIKeyInput
instead of UITextInput
(didn't change anything else) and now insertText gets called, but setMarkedText/unmarkText no longer get called (as expected).
I don't think insertText not being called is expected based on what was said in the session and what I can find online. However I have never worked with these protocols before so I may be misunderstanding how they work.
SwiftUI
I'm doing this from a SwiftUI app using UIViewRepresentable
, and I'm not actually showing the UIView anywhere, just including it in the hierarchy to be able to call captureTextFromCamera and get the relevant protocol methods called to capture the text.