Custom Keyboard in Swift

Overview

In this tutorial we’ll create a Custom Keyboard extension. Custom keyboard extensions allow you to set your own designed keyboard in apps. It lets user add image in keyboard, that make your keyboard steal the show.

Implementation

Step 1 – Create a new Single View Application

custom_keyboard_image5

Step 2 – Now create keyboard extension, go to File → New → Target.

custom_keyboard_image10

Step 3 – Select Custom keyboard Extension from Application Extension.

custom_keyboard_image1

Provide a name of your Extension and select your programming language.

custom_keyboard_image2

Now, it will include following list of files in your project folder.

custom_keyboard_image3

Adding keyboard

Go to Settings → General → Keyboard → Keyboards

Now Click on Add New Keyboard..

custom_keyboard_image6

Here different types of keyboard are shown such as Suggested, third party and other, click on your custom keyboard under third party keyboards.

custom_keyboard_image11

Now you need to allow full access to the custom keyboard, just to set background image to keyboard.

custom_keyboard_image9

Now you have successfully added your custom keyboard in your device, open any app and change your keyboard to custom keyboard.

Open your keyboard, click on the globe icon and a pop up view will appear, select your keyboard.

custom_keyboard_image8

Now you have successfully set your custom keyboard as default one.

custom_keyboard_image4

Changing Image in Custom keyboard

custom_keyboard_image7

Limitations

After adding Custom keyboard, it doesn’t mean that it will always be available, here are the below examples where custom keyboard doesn’t seem to be available.
→ If the text contain its Input type as Password, when the secureTextEntry is set to true.
→ When the keyboard type is set to UIKeyboardTypePhonePad or UIKeyboardTypeNamePhonePad.
→ Last but not least, if the user declines the use of keyboard extension in AppDelegate Method
application(_ application: UIApplication, shouldAllowExtensionPointIdentifier.

mm

Jayesh Tejwani iOS Developer

I am Jayesh Tejwani, iOS Developer at Yudiz Solution Pvt. Ltd. - a leading iPhone App development company. I am passionate about new innovation’s and a deep learner, love to explore my ideas into realistic and a creative ios app dev.

Comments are closed.

Top