Keyboard extension input auto enter

Hi all,

So im develop a keyboard extension to have it custom for my distinct host app. The keyboard are connect with hardware barcode scanner.

I have problem to auto 'send' the form when the barcode read. So, if I have other string (barcode) combine with the ("\r"), this will not trigger the auto send.

func performBarcodeScan(barcode: String, scanner: String) {
        textDocumentProxy.insertText(barcode+"\r")
}

But, I tried with this situation where i already type some string input in the field and have only ("\r") as below, that will work

func performBarcodeScan(barcode: String, scanner: String) {
        textDocumentProxy.insertText("\r")
}

have the insertText twice to separate the string also not work.

I hope anyone can help with this as i have been stuck forrr a longgggg time.

Thanks in advanced!

Keyboard extension input auto enter
 
 
Q