I'm trying to write Custom Keyboard Extension
.
I'm looking for the way to know where the cursor is on UITextField
,UITextView
...etc in CustomKeyboardExtension ... but I don't see anything like that.
I saw SwiftKey app (http://swiftkey.com) can do that (or do something like that). When I change the cursor, suggestion-text will change (see below pictures).
Q: How can we get current text selection?
...
UPDATE: 29/09/2014
Ok, I'm so foolish. We can use documentContextBeforeInput
, documentContextAfterInput
methods of textDocumentProxy
property. I thought that "Before","After" are about the time. Actually it's about the position.
Sorry all! I wasted your time :(
Create lastWordBeforeInput method...
Then call it with textWillChange/textDidChange as per requirement.
Hope this will help you.