0

I am using UILexicon for the suggestions in custom keyboard. Following is code:

-(void) keyTapped:(UIButton*)button {



    [self requestSupplementaryLexiconWithCompletion:^(UILexicon *lexicon){
        //  self.lexicon = lexicon;
        NSLog(@"%@",lexicon.entries);
        for (UILexiconEntry* entry in lexicon.entries) {
            NSLog(@"%@=%@",entry.userInput,entry.documentText);
        }
        int i=0;
    }];


}

But it is returning always same array of entries. Can anyone suggest me how to use it. I will mark correct your answer if it works. Thanks.

Sukhpal Singh
  • 672
  • 1
  • 12
  • 31

1 Answers1

0

It's working but you should implement your own function to compare the UILexiconEntry list with the entered string as stated by apple :

UILexiconEntry A lexicon entry specifies a read-only term pair, available within a UILexicon object, for use by a custom keyboard. You can employ a lexicon entry by matching user input against the entry’s userInput value, and then inserting into the current text input object the corresponding documentText value. For example, if the user typed the string “iphone”, the lexicon entry with that exact, case-sensitive string in the userInput property has the string “iPhone” in the corresponding documentText property. In some cases, the documentText string is in a different text script than the userInput string.

Moataz Hossam
  • 413
  • 7
  • 20