KeyboardKit is a Swift library that helps you create custom keyboard extensions for
The end result can look something like this...or entirely different:
KeyboardKit lets you create rich system keyboards with support for multiple locales, gestures, callouts etc.
If you're new to iOS keyboard extensions, this great guide will help you get started. You can also have a look at the demo app for inspiration.
Swift Package Manager
target 'MyApp' do pod 'KeyboardKit' end target 'MyKeyboard' do pod 'KeyboardKit' end post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No' end end end
To build a keyboard extension with KeyboardKit, first add
KeyboardKit to your app's keyboard extension as shown above. You can add it to the main app target as well, if you want to use it there.
KeyboardInputViewController instead of
UIInputViewController. It provides you with a lot of additional functionality, e.g. new lifecycle functions, observables like
keyboardContext and services like
keyboardAppearance, autocomplete logic etc.
KeyboardInputViewController will call
viewWillSetupKeyboard whenever the keyboard must be created or re-created. You can use
setup(with:) in that function, to setup your extension with any
Setting up the view controller with a SwiftUI view will make the view the main view of the extension, inject necessary environment objects and resize the keyboard extension to fit the view.
Have a look at the demo application and read more below to see how it all fits together.
KeyboardKit is localized in the following languages:
🇺🇸English (US - Default)
KeyboardKit also supports localized keyboards, where the keyboard layout, secondary actions etc. behave just like they should for a certain locale.
Even though KeyboardKit contains a lot of features, you can use its' extensions and views alone to simplify working with keyboard extensions. For instance, there are a bunch of
UITextDocumentProxy extensions that make your life easier, and views that don't require you to use the rest of the library.
Check out the demo apps and source code for examples and more information.
KeyboardKit comes with many keyboard-specific actions, like
image etc. You can even create your own actions.
KeyboardKit comes with an appearance engine that lets you easily style your keyboards.
KeyboardKit defines system audio types and ways to play them.
KeyboardKit can present autocomplete suggestions as users type.
KeyboardKit lets you show input callouts as users type, as well as secondary action callouts with secondary input actions.
KeyboardKit defines emojis and emoji categories that you can use in your own keyboards.
KeyboardKit provides a bunch of extensions to native types.
⌨️ External Keyboards
KeyboardKit lets you detect whether or not an external keyboard is used.
KeyboardKit keyboards can give audio and haptic feedback as users type.
KeyboardKit comes with keyboard-specific gestures that you can use in your own keyboards.
KeyboardKit defines haptic feedback types and ways to trigger them.
KeyboardKit comes with an input set engine that make it easy to create
symbolic keyboards in different languages.
⌨️ Keyboard Layouts
KeyboardKit comes with a layout engine that makes it easy to create specific keyboard layouts for various devices, orientations and locales.
💱 Keyboard Types
KeyboardKit comes with many different keyboard types, like
emoji etc. You can even create your own types.
KeyboardKit defines keyboard-specific locales and provides localized content for the supported locales.
[Read more here][Locales]
KeyboardKit defines a bunch of preview-specific types that simplify previewing keyboard views in SwiftUI.
KeyboardKit defines a bunch of extensions to
UITextDocumentProxy and ways to route text to other sources.
KeyboardKit defines a bunch of styles that simplify customizing the look of various keyboard components and buttons.
KeyboardKit comes with a bunch of keyboard-specific views:
Autocompletecontains autocomplete toolbars and toolbar items.
Calloutscontains input and secondary input callout views.
Emojiscontains various emoji keyboards and keyboard components.
Inputcontains text inputs that can be used in a keyboard extension.
Systemcontains views that can be used to mimic native systme keyboards.
KeyboardGridcan be used to evenly space a set of views in a grid.
NextKeyboardButtoncan be used to switch to the next keyboard.
You can also use these views without using the rest of KeyboardKit.
This repository contains a demo app that demonstrates different keyboards, like
alphabetical (lowercased, uppercased and capslocked),
The demo app is not intended to be production ready, but rather to give you inspiration to how you can build your own keyboards. Just keep in mind that your keyboards can look anyway you like. They don't have to look like a system keyboard.
To run the demo app, open and run the
Demo/Demo.xcodeproj project, then enable the keyboards under system settings. Enable full access to support all features, like audio and haptic feedback.
Note that you may have to update the KeyboardKit dependencies for the demo to run. If so, you can do that under
File/Swift Packages/Update to Latest Package Versions.
KeyboardKit Pro is a license-based extensions that unlocks pro features, such as additional locales and an autocomplete engine. Going pro is also a way to support this project.
Feel free to reach out if you have questions or if you want to contribute in any way:
Sponsors and Clients
This project is proudly sponsored by the following individuals and companies:
KeyboardKit is available under the MIT license. See LICENSE file for more info.