General questions

ATK 2.2 iOS SingleLineWidget Keyboard Extension


I am developing iOS keyboard extension with handwriting recognition like MyScript Stylus, I am using ATK 2.2 SDK ATKSingleLineWidget Framework(same as you do in your app, I guess) but performance is much worse than MyScript Stylus. I would be very thankful if you can give some advices and tips. I have following issues : 

1. I am doing configuration in viewDidAppear method and It's taking time to draw singleLineWidget, seems like lag.

2. Since UITextDocumentProxy gives limited functionality, I can't change entire text with singleLineWidget text, I must clear inputField and then insert recognized text, which I'am doing with deleteBackwards method. This approach causes lag.

3. How can I detect when user moves cursor on inputField to scroll singleLineWidget on proper position?

Dear Saba,

Currently, the MyScript Stylus is much older than the SingleLine Text widget, and do not rely on the same technology. Stylus is indeed lighter than the Single Line Text Widget.

1-Regarding the lag, which device are you using? Indeed, we never had complaints regarding this.
2-Which function are you using to replace text? The replaceCharacters function? Indeed, with this latter one, you do not need to clear and update text.
3-Did you have a look to the onUserScrollBegin, onUserScroll and onUserScrollEnd functions?  These may answer your needs?

Best regards,


Hello Olivier,

Thanks for your answer.

1- I am testing on iPhone 5 iOS 10, iPhone 6s iOS 11 and iPad Pro iOS 11. I've just made some optimizations now it's working great. Thanks

2-I think I didn't make clear my question, I need clear textDocumentProxy text because singleLineTextWidget is returning whole text not only new, if I call insertText method on textDocumentProxy, it will cause duplicate text

3-I have problem when user moves cursor not on the keyboard but on the input, which doesn't informs you about it

Dear Saba,

for point 2, when the onTextChanged function is raised, you have the whole text... Maybe you could then have a "temporary" variable which stores the text result... when the onTextChaged function is raised, you compare the new string with the previous one, and just provide with the delta to the textDocumentProxy.

For point 3, I am afraid we have no solution.

Best regards,


Dear Olivier,

Thanks a lot for helping, you are doing great job.

For point 3, I've got a solution and I hope it will help other developers who may have same issue

UITextInputDelegate gives function textDidChange when user taps on anywhere on inputField. In this delegate method you can get documentContextBeforeInput (NSString type) from textDocumentProxy which is text before the cursor. So length of this string is current cursor position and you can easily set this to the cursorIndex property of singleLineWidget and call smoothScrollToCursor.

Best regards.

Login or Signup to post a comment