How can I implement Apple's predictive input panel in my own iOS8 custom keyboard extension?
Apple's Custom Keyboards API Doc Custom Keyboard states:
RequestsOpenAccess
setBOOL
yes in info.plist has access to a basicautocorrection
lexicon through the UILexicon class. Make use of this class, along with a lexicon of your own design, to providesuggestions
andautocorrections
as users are entering text.
But i can't find how to use the UILexicon
in my custom keyboard. I set the RequestsOpenAccess
setting to YES
:
But still can't get access to a custom dictionary for word suggestions like Apple's iOS8 default keyboard does:
My custom keyboard look like:
EDIT:
i Found requestSupplementaryLexiconWithCompletion
that used for UILexicon class
like this i try to implement this using following code:
- (void)viewDidLoad {
[super viewDidLoad];
[self requestSupplementaryLexiconWithCompletion:^(UILexicon *appleLex) {
appleLexicon = appleLex;
NSUInteger lexEntryCount = appleLexicon.entries.count;
for(UILexiconEntry *entry in appleLexicon.entries) {
NSString *userInput = [entry userInput];
NSString *documentText = [entry documentText];
lable.text=userInput;
[lable setNeedsDisplay];
}
}];
}