Skip to main content
Back to Blog

Custom Keyboard In iOS: Step-by-Step Guide With Fleksy SDK

Reading Time: 9 minutes

Key takeaways (+ quick video guide)

Creating your own keyboard to use on mobile devices can be a good way of customizing it to match your needs or your customers’. Develop your own layout, add new functions, and enhance user experience. However, starting from scratch can represent spending months of work and investing fortunes to develop all the necessary components to get a final result that is even better than current options. To avoid this step, developers can buy a keyboard SDK to skip all the basic development processes and focus on new, innovative ideas and design. 

The Fleksy SDK offers developers a powerful predictive text and autocorrection engine, strong security algorithms, and innovative functions, like the embedded extensions, that can set the pillars for creating a new outstanding keyboard that you can customize as you need. But, how can you use this kit and its components to make a brand-new custom keyboard using the Fleksy SDK for iOS devices? Use the XCode tool!

What is iOS SDK used for (& all the advantages of XCode IDE)

The Fleksy SDK can be used for creating custom keyboards for Apple and also Android devices. If creating keyboards for Apple, download the iOS SDK from our website. After that, you’ll need to use a development environment to deploy the SDK and create the keyboard per se. If working on iOS, use the XCode IDE.

XCode is an Integrated Development Environment. That means it’s an internal tool you can use within your Apple device to develop new applications. In this case, we will use it to create a custom keyboard. There are other ways you can create your own apps, but XCode is the best option, and this is why:

Faster development

The latest version of XCode (14.0.1) is faster than previous versions, as it has a user-friendly interface that makes the process easier.

Ease of use

This app contains several integrated apps to make the development more efficient, enabling numerous functionalities and detailed settings.

Customizable environment

Developers can enable extensions within the app to suit their needs, and thus, make the process faster and easier.

Cross-device testing

The environment includes a device simulator to test the app on different Apple devices without having to move from one to another.

Variety of languages supported

Coding can be written into this platform using different programming languages according to the app’s potential use, like Swift, Objective-C, Objective-C++, C, C++, Java, Python (translated to Objective-C), and more.

Get started

Step 1: Install XCode, the integrated development environment (IDE) by Apple

The first step you need to take is to download the XCode IDE from Apple’s website or the App Store application. To download it from the website, you’ll need to register as an Apple Developer first.

Step 2: Register as an Apple Developer 

Access the Apple website and create an Apple Developer account. Follow the instructions on the site and enter the corresponding information. After that, you’ll be able to download and launch the XCode app on your device.

Step 3: Create a new iOS keyboard project

Once you have registered as an Apple Developer and downloaded the XCode app, it’s time for setting up your own custom iOS keyboard. Launch the XCode app on your device and select Create new XCode Project on the options list.

Create a custom keyboard in iOS

Start a new project

When you choose the creation function on the app, select the App option and click on Next. Create a name for the project in the pop-up window and the location where you want to save the app.

On the program’s toolbar, click on File, go to New, and select Target. This will open a new pop-up window where you will choose to create a custom keyboard extension. Name it as you wish, save it, and activate it as indicated by the program.

Insert the Fleksy SDK

Looking at the Project tab in the IDE, click on the new project you have just created. Open the Package Dependencies tab and add a new one. This will open a list with a number of packages where you have to select the Fleksy SDK. To do this, copy the GitHub URL that you got after purchasing a Fleksy license and paste it into the search box to add the package.

Implement the Fleksy SDK

  • Once the Fleksy SDK is installed in the IDE, it’s necessary to adjust some settings. First, select the new keyboard in the list on the left and enter the KeyboardViewController. This will open the code contained within the SDK. Look for the license key configuration on lines 29 and 30; you’ll see you must insert a license key and a license secret. To get this information, register on developers.fleksy.com and then insert it in this section. 
  • Before moving on, you also need to disable bitcode in the IDE; as the Fleksy SDK does not support this type of code. To do so, highlight the main containing file for the app you are working on and select your keyboard in the targets section. Go to the Build settings tab and look for bitcode on the search box. There, disable bitcode, and then you’re good to go.
  • After that, you need to grant access to the keyboard within the device. Highlight your keyboard again and go to the Info tab. Here, expand the NSExtension menu and then the NSExtensionAttributes. Once there, find the RequestsOpenAccess option and change the setting to 1. 

Activate your new Fleksy keyboard

After all the settings in XCode are ready, you’ll need to activate the keyboard within the device to get full access to it. If you try to type in any app by this point, you will still be using the standard built-in keyboard, and you won’t see any option to change it either. To do so, you’ll need to grant access to the keyboard. 

Go to the settings menu on your phone and tap on General, go to keyboard, then keyboards, and there you will see the option to add a new keyboard. Here, you can see the built-in keyboards and third-party ones, and that’s where you’ll find your custom keyboard. Tap it and you will be redirected to the previous menu, now with your own keyboard on the list. Tap on it again, and there you will see a switch to Allow Full Access

From now on, you can try to tap on any app, and there you will be able to switch between keyboards and select your custom version. 

iOS SDK components: Cocoa and the most important frameworks 

Cocoa platform

Once you have set up the founding pillars for your custom iOS keyboard, now comes the time to differentiate from other third-party keyboards and customize your app. While still working in the XCode environment, there are several tools you can use to exploit your keyboard app to the maximum. One of these options is using the Cocoa platform. This platform is used for creating new apps for all of Apple’s devices and contains libraries and functionalities that make the creation process faster. it utilizes Objective-C as its core language, but it supports C and C++ too, and even Python and Ruby for macOS apps using script bridges.

Cocoa embedded frameworks

Within the Cocoa platform, you can find a series of sub-platforms depending on the device you want to create apps for and their corresponding SDKs. Each of these SDKs contains frameworks that provide coding for implementing different functions and features in your app. The most important frameworks are:

Foundation Framework

Contains libraries for core OS services in iOS and OS X, and can be used for creating apps compatible with both operating systems.

AppKit

Used for creating apps used in macOS, as it has a UI that is usually compatible with mouse and keyboard input.

UIKit

Mostly used in iOS and tvOS apps, as it’s used in UI controlled with touchscreens. Because these two frameworks are used with different interfaces, the classes included are different, but many of the concepts are very similar.

WatchKit

Used for creating apps to be used within the Apple Watch interface.

Design and personalize the iOS keyboard

Using the Cocoa frameworks, you can explore the different functions they have to offer and modify your custom virtual keyboard as any other app. As the Fleksy virtual keyboard SDK has already provided the developer with all the necessary code for predictive text, autocorrection, and other essential and innovative functions, they can take the time to explore all the variables available regarding layout, design, and extra functions.

Explore the keyboard layout

One of the possible variables in your custom keyboard is the layout. Most popular keyboards nowadays use the QWERTY layout, and allow users to change to AZERTY, Dvorak or T9 layouts. However, you can create your own layout depending on your accessibility goals, for instance, making the keyboard more accessible to people with motor disabilities.

Implement keyboard actions

Another interesting functionalities you can modify in your custom keyboard are actions. These can be, for example, gestures. These will allow them to activate functions in the keyboard without having to look for them on a settings menu or tapping a specific key.

Custom keyboard appearance

Fleksy keyboards are known to be highly customizable in terms of appearance. The Fleksy SDK allows developers to change the theme in the keyboard, add a background picture, customize the space bar, and even add effects to keys when pressed. 

Support different keyboard sizes

Some keyboard manufacturers allow users to modify the size of the keyboard in the settings menu, making the layout look more elongated or compressed to change the overall size of keys. Besides, users can decide to turn the keyboard into landscape mode, arranging it horizontally. Although in some cases it might not be so comfortable, in combination with swipe typing, users can type more easily, especially on bigger screens like tablets or digital assistants. 

Add multilingual functionality

The Fleksy SDK contains dictionaries for more than 82 languages, enlarging the target audience who could benefit from the keyboard. Provide users with a language-switch function to further enhance user experience.

Best practices and tips (by developers for developers)

When creating any kind of app, including virtual keyboards, there is a series of best practices that can help developers save time and keep a well-organized workflow, and thus achieve more efficient results. Here are some of them.

Understand iOS Application Life Cycle 

It is of utmost importance to understand the basics of how every app works within the iOS environment. Besides the particular functions each app has, they all have the same life cycle in terms of launch and termination.

The iOS life cycle is made up of 5 steps:

  • Not running: In the first step, the app has still not been launched, so it is not executing either in the foreground or the background.
  • Inactive: Once the user launches the app, it enters the inactive stage, as it enters the foreground but is still not executing any events. During this process, the app restores its previous status.
  • Active: At this point, the app is in the foreground and executing events.
  • Background: When the user leaves the app, it can remain active in the background, still executing events.
  • Suspended: The app is in the background, not executing events anymore. At this point, the app will be terminated if not used for a certain time or if the memory is overloaded. 

Manage data with CoreData 

CoreData is a framework created by Apple to assist developers make new apps by managing the app’s object graph. This program allows developers to save permanent and temporary data in the cloud for future use, and also tracks changes to allow the undo function along the process, either individually or in batches.

Test and debug your app with iOS Simulator 

The best way to ensure success in creating and deploying a new app is by testing it. Explore the functions and the settings to see how smoothly it runs and look for bugs that may require solving. This can be done within the XCode IDE, as it contains a simulator for all Apple devices, or manually on multiple devices. Run performance tests on every device you plan to launch the app for.

Enhance user experience

Testing and debugging are key for ensuring user acceptance, but other factors can affect it. To make sure you are suiting your users’ needs, keep track of their comments on App Store (or Play Store on Android devices) and adapt in consequence. To go even further, conduct market research to find out what other developers are offering and differentiate from them by providing innovative, original functions.

Prioritize privacy and security

Make security your priority. Nowadays, people use their phones for everything: social media, work communication, baking processes, medical appointments, etc. For this reason, users are increasingly more concerned about privacy assurance when using their devices. As a consequence, developers need to make privacy and security one of the top characteristics to keep users happy and differentiate from other manufacturers. Fortunately, the Fleksy SDK also has a security-focused approach and provides developers with algorithms to protect user data.

Conclusion

Although the whole process of creating a new app can be long and tiring, using innovative tools can help developers lead to faster and more efficient results. 

When creating iOS custom keyboard for Apple products, shorten development time by using the Fleksy SDK to skip creating the code for predictive text, auto-correction and swipe typing, among other functionalities, and combine it with Apple development tools like XCode, Cocoa and CoreData to ensure compatibility, debugging and an overall successful outcome. Get started on your virtual keyboard journey here!

FAQs

What is virtual keyboard iOS?

Virtual keyboards are apps embedded in digital devices to allow users to input text. These virtual keyboards can be built-in into your device, or you can install a new one from the App Store. Developers can also create their own in-app keyboards to customize them according to their users’ needs.

How to develop an iOS keyboard?

An iOS keyboard can be created using the XCode IDE, Apple’s tool for creating new applications. Keyboards can be created from scratch, or developers can use SDKs like Fleksy’s that already provide some functionalities and part of the code to make the process faster.

Is there a project example to test for iOS?

Yes, you can test the Fleksy SDK before buying it here to see in advance some of the functionalities we have to offer. You can find sample projects for both Android and iOS.

How do I run the iOS SDK?

The iOS SDK has to be run within XCode, using the Cocoa platform. The iOS SDK contains frameworks with classes and pieces of code for including a number of functions in your new app.

How to update iOS SDK? 

If you get a warning sign on XCode saying that your iOS SDK is outdated, you can access the App Store and download the latest version.

What computer language is used in the iOS SDK?

The iOS SDK can be used with several computer languages. This platform is compatible with Swift, C#, ObjectiveC, Java, JavaScript and Dart, among others, each of them used for different purposes.

What is the difference between Xcode and iOS SDK?

XCode and iOS SDK cannot be compared because they are two different elements. XCode is an Integrated Development Environment (IDE), that is, a platform for creating apps, and the iOS SDK is a Software Development Kit, a set of code strings for implementing certain functions into new apps. The iOS SDK has to be installed into the XCode environment for creating a new app.

Did you like it? Spread the word:

✭ If you like Fleksy, give it a star on GitHub ✭