Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use requestSupplementaryLexiconWithCompletion

Tags:

swift

ios8

I am not sure as to how to use the requestSupplementaryLexiconWithCompletion as outlined on the Apple Developer site here.

I have the following function

override func requestSupplementaryLexiconWithCompletion(completionHandler: ((UILexicon!) -> Void)!) {
    appleLexicon = UILexicon

}

I am just lost as how to get a the UILexicon, then look at the pair values returned. E.g print them to the console to see its output.

like image 825
Andrew Seeley Avatar asked Oct 24 '25 17:10

Andrew Seeley


1 Answers

You can try to use it like:

func handler(lexicon: UILexicon!)  {

    println(lexicon.description)
}

@IBAction func click(sender: AnyObject) {
    let controller = UIInputViewController()

    controller.requestSupplementaryLexiconWithCompletion(handler)
}

Or like:

@IBAction func click(sender: AnyObject) {
    let controller = UIInputViewController()

    controller.requestSupplementaryLexiconWithCompletion({
        lexicon in

        println(lexicon.description)

        })
}

click method is just a UIButton tap event handler

like image 118
Alex Peda Avatar answered Oct 26 '25 06:10

Alex Peda



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!