Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS8 Custom Keyboard using Storyboards

Anyone know how to create a custom iOS keyboard in Xcode6 using storyboards? I've built a keyboard fully using code using a single application template. It works fine, but I want to build another keyboard using storyboards as I think it will be easier.

Can't figure out how to connect a storyboard to the KeyboardViewController.m? Anyone know how, and a set of steps to do this? Thanks!

like image 621
Kjell Avatar asked Sep 22 '14 17:09

Kjell


2 Answers

Yes it's absolutely possible. Once you created your target extension, right click and add a New Storyboard. Inside this storyboard, you must define the Custom Class as a KeyboardViewController.

Then, one thing is missing: you should add NSExtensionMainStoryboard with the name of your freshly created storyboard without the extension in the NSExtensionAttributes of your extension info.plist file and remove the NSExtensionMainClass property from it.

A little clean and run and voilà! A keyboard that use a storyboard! Hope that will help!

like image 169
r0ms Avatar answered Nov 11 '22 14:11

r0ms


Under the extension, inside the info.plist file, under NSExtension Dictionary, add a new item called NSExtensionMainStoryboard, set the name according to your storyboard name, and then remove the NSExtensionPrincipalClass.

Note: tested in Xcode 6.4, using Swift.

like image 45
Bob Avatar answered Nov 11 '22 14:11

Bob