Sunday, 30 November 2014

Create keyboard extension in IOS 8 SDK - (Part 1 - Introduction)




IOS8 extensions
Tags: #Keyboard extension #Tutorial #IOS8 

Extensions are the new features introduced in IOS 8 and like android developers, IOS developers can also override default keyboards with their custom keyboard.

This is a wonderful feature as IOS users can set  a keyboard of their IOS devices as per their choices and offer different themes to the keyboards.

                 In this post we are going to learn, how can we create our keyboard extension app.



Create a new project and select Single View Application

Create New project inXCODE 6.1
Create New project in XCODE 

Name it MYCustomKeyboard, we are setting default language as Objective C

Setting name to our xcode project
Setting name to our Xcode project


Press Next and then Done. A workspace window will open as shown in picture below

Xcode project workspace


This is our main app. To create an extension we had to add new target, Click on File Menu
New -> Target -> a pop up window will appear, select Custom Keyboard -> press Next -> Give it a name, we named it as Demo -> click Finish.

Xcode will prompt you to activate Demo scheme, press Activate. You will see a new folder named Demo has been added.


Opening this folder, you wil
l see two


 files

K
eyboar


dV
iewCont
roller.h
Keyboar

dViewController.m

Now when you open, KeyboardViewController.m you will see pre loaded code. Xcode writes preloaded code for globe button and added constraints to it. Shown in picture below

KeyboardViewController.m


At this time we had our extension project configured and if you want to made any customization to your keyboard (at this time it only display next button via default) in KeyboardViewController.m
file.

Run your app, select app target not extension target as extension gets automatically installed when container app or main app gets installed in the app.

To activate your keyboard. Open up settings app,  select General -> Keyboards -> Add New Keyboard.. -> there is a list of third party keyboards installed on your device, you will also see a name similar to your project name in our case it is MYCustomKeyboard -> select it. 

Open up safari app, default keyboard will appear, tap on globe key , emoji keyboard will appear depends upon your keyboard order setting in Settings app. Again tap on globe key, you will see custom keyboard with next keyboard button.

Custom KeyBoard iPhone 4S simulator
Custom KeyBoard iPhone 4S simulator
That's it. Hope you this post helps you learning how to create keyboard extension in IOS 8 SDK.
In next post we will create our custom keyboard with buttons and load it from xib file.

Thanks for reading this stuff. Appreciated your time. :)

Second part of the series

1 comment:
Write comments
  1. Nice explanation regarding Keyboard extension in IOS 8. Looking for tuts online and this comes as a handy tutorial.

    ReplyDelete