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.
Step 1 – Create a new Single View Application
Step 2 – Now create keyboard extension, go to File → New → Target.
Step 3 – Select Custom keyboard Extension from Application Extension.
Provide a name of your Extension and select your programming language.
Now, it will include following list of files in your project folder.
Go to Settings → General → Keyboard → Keyboards
Now Click on Add New Keyboard..
Here different types of keyboard are shown such as Suggested, third party and other, click on your custom keyboard under third party keyboards.
Now you need to allow full access to the custom keyboard, just to set background image to keyboard.
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.
Now you have successfully set your custom keyboard as default one.
Changing Image in Custom keyboard
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.