KeyboardKit is a Swift library that helps you create custom keyboard extensions for iOS
and ipadOS
.
KeyboardKit provides you with actions
, input sets
and layouts
, appearances
and autocomplete
support, haptic
and audio
feedback etc. It lets you create keyboards with characters
, numbers
, symbols
, emojis
, images
and more or just use the additional tools
and extensions
that it provides.
The end result can look something like this...or entirely different:
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.
https://github.com/KeyboardKit/KeyboardKit.git
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, add KeyboardKit
to your project as shown above.
If you use Swift Package Manager, make sure to add KeyboardKit to your keyboard extension. You can add it to your hosting app as well, but the keyboard extension must have it.
You can then import KeyboardKit
and let your KeyboardController
inherit KeyboardInputViewController
instead of UIInputViewController
. It's a KeyboardKit-specific controller that provides you with a lot of additional functionality that extends the native keyboard framework. Your controller will get a bunch of extra properties, like keyboardContext
, keyboardActionHandler
, keyboardAppearance
etc. and the extension will get access to autocomplete logic, extensions and much, much more.
KeyboardInputViewController
has a setup(with:)
function that can be used to setup your extension with any SwiftUI
view. This will make the view the main view of the extension, inject necessary environment objects and finally resize the keyboard extension to fit the view.
To learn more about and see KeyboardKit in practice, continue reading about the various parts of the library below and have a look at the demo app to see how it sets up a custom keyboardView
and adjusts it depending on the keyboard type, locale etc.
KeyboardKit Pro is a license-based extensions that unlocks pro features, such as additional locales. Going pro is also a way to support this project. Read more here.
You can try KeyboardKit Pro in the demo app, by activating the commented out setupPro
line in the demo app's KeyboardViewController
.
KeyboardKit supports both SwiftUI
and UIKit
, but SwiftUI is the main focus going forward. You can read more about UIKit support here. The rest of this readme assumes that you're using SwiftUI, although most information is valid for both UIKit and SwiftUI.
KeyboardKit comes with many keyboard-specific actions, like character
inputs, emojis
, backspace
, space
, newline
, image
etc. You can even create your own actions.
KeyboardKit comes with many different keyboard types, like alphabetic
, numeric
, symbolic
, emoji
etc. You can even create your own types.
KeyboardKit comes with an input set engine that make it easy to create alphabetic
, numeric
and symbolic
keyboards in different languages.
KeyboardKit comes with a layout engine that makes it easy to create specific keyboard layouts for various devices, orientations and locales.
KeyboardKit comes with built-in support for English keyboards and can be easily extended to support more locales.
KeyboardKit also has a KKL10n
enum that provides localized texts.
KeyboardKit lets you create everything from completely custom keyboards to keyboards that imitate the native keyboards and can be styled with custom appearances.
KeyboardKit lets you show callout bubbles as the users type, as well as secondary action callouts that can provide users with optional actions when long pressing a keyboard button.
KeyboardKit can present autocomplete suggestions to users as they type. The core library doesn't come with an implemented engine, but you can inject your own.
KeyboardKit keyboards can give users haptic feedback as they type.
KeyboardKit keyboards can give users audio feedback as they type.
KeyboardKit comes with many keyboard-specific extensions, like providing the text document proxy with powerful, otherwise missing functionalty etc. Check out the demo apps and source code for examples and more information.
This repository contains a demo app that demonstrates different keyboards, like alphabetical
(lowercased, uppercased and capslocked), numerical
, symbols
, emojis
and images
.
The demo app is not intended to be production ready or provide pixel perfection, but rather to give you inspiration to how you can build your own keyboards.
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.
Feel free to reach out if you have questions or if you want to contribute in any way:
- E-mail: [email protected]
- Twitter: @KeyboardKit
- Web site: danielsaidi.com
This project is proudly sponsored by the following individuals and companies:
You can support my work by sponsoring the project on GitHub Sponsors or hiring me for consultation. I'd be happy to help you out in any way that I can.
KeyboardKit is available under the MIT license. See LICENSE file for more info.