title: Implement Autocorrect in iOS 8 Keyboard Extension
body: <p>I'm creating a custom iOS 8 keyboard as a pet project.</p>
  
  <p>I'm trying to replicate the system keyboard as accurately as possible, but building it from the ground up.</p>
  
  <p>I'm largely done with this. The final hurdle I'm encountering is with adding autocorrect to my keyboard. Is there a way I can have the autocorrect behave as it would on the regular system keyboard?</p>
  
  <p>The <a href="https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UILexicon_Class/index.html" rel="nofollow">UILexicon documentation</a> is quite sparse.</p>
  
  <p>EDIT:</p>
  
  <p>Making some progress with this. UILexicon's <a href="https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIInputViewController_Class/index.html#//apple_ref/occ/instm/UIInputViewController/requestSupplementaryLexiconWithCompletion:" rel="nofollow"><code>requestSupplementaryLexiconWithCompletion:</code></a> method appears to only be returning results from my device's Contacts and keyboard shortcuts. I then went on to see how to autocorrect an NSString and found the <a href="https://developer.apple.com/library/iOS/documentation/UIKit/Reference/UITextChecker_Class/Reference/Reference.html#//apple_ref/occ/instm/UITextChecker/rangeOfMisspelledWordInString:range:startingAt:wrap:language:" rel="nofollow">UITextChecker class</a>, which has been available since iOS 3.2.</p>
  
  <p>Using this approach I can achieve autocorrect suggestions on individual words, but I'm still investigating the ability to add context-aware autocorrect (e.g. correcting "arctic monkeys" to "Arctic Monkeys").</p>