KeyboardKit helps you create custom keyboard extensions with Swift and SwiftUI.
KeyboardKit extends Apple's native APIs and provides you with a lot more functionality. It lets you create custom keyboards that mimic native iOS keyboards with just a few lines of code.
KeyboardKit lets you customize all parts of the keyboard. You can use custom layouts, designs, behavior, etc. and make any key or gesture trigger any action. You can even use completely custom views and just use the underlying functionality.
You can use KeyboardKit in many different ways. Keyboard extensions can use it to create custom keyboards. Apps can use it to check keyboard enabled state, full access, state, provide settings etc. Furthermore, any target can use it to build upon its models and functionality.
KeyboardKit can be installed with the Swift Package Manager:
https://github.com/KeyboardKit/KeyboardKit.git
After installing KeyboardKit, make sure to link it to all targets that need it.
KeyboardKit supports 63 keyboard-specific locales:
๐ฆ๐ฑ ๐ฆ๐ช ๐ฆ๐ฒ ๐ง๐พ ๐ง๐ฌ ๐ฆ๐ฉ ๐ณ๏ธ ๐ญ๐ท ๐จ๐ฟ ๐ฉ๐ฐ
๐ณ๐ฑ ๐ง๐ช ๐บ๐ธ ๐ฌ๐ง ๐บ๐ธ ๐ช๐ช ๐ซ๐ด ๐ต๐ญ ๐ซ๐ฎ ๐ซ๐ท
๐ง๐ช ๐จ๐ญ ๐ฌ๐ช ๐ฉ๐ช ๐ฆ๐น ๐จ๐ญ ๐ฌ๐ท ๐บ๐ธ ๐ฎ๐ฑ ๐ญ๐บ
๐ฎ๐ธ ๐ณ๏ธ ๐ฎ๐ฉ ๐ฎ๐ช ๐ฎ๐น ๐ฐ๐ฟ ๐น๐ฏ ๐น๐ฏ ๐น๐ฏ ๐ฑ๐ป
๐ฑ๐น ๐ฒ๐ฐ ๐ฒ๐พ ๐ฒ๐น ๐ฒ๐ณ ๐ณ๐ด ๐ณ๏ธ ๐ฎ๐ท ๐ต๐ฑ ๐ต๐น
๐ง๐ท ๐ท๐ด ๐ท๐บ ๐ท๐ธ ๐ท๐ธ ๐ธ๐ฐ ๐ธ๐ฎ ๐ช๐ธ ๐ฐ๐ช ๐ธ๐ช
๐น๐ท ๐บ๐ฆ ๐บ๐ฟ
KeyboardKit provides a basic keyboard layout and callout actions, whileย KeyboardKit Pro provides localized layouts, callouts and behaviors for all supported locales.
KeyboardKit comes packed features to help you build amazing keyboard extensions:
- โจ๏ธ Essentials - KeyboardKit comes with a bunch of essential features and types.
- ๐ฅ Actions - KeyboardKit has keyboard actions like characters, actions, etc.
- ๐ค AI Support - KeyboardKit has capabilities that are needed for AI.
- ๐ก Autocomplete - KeyboardKit can perform autocomplete and autocorrect.
- ๐ค Buttons - KeyboardKit can style any view as a keyboard button.
- ๐ฏ Callouts - KeyboardKit can show input and secondary callouts.
- ๐ Colors - KeyboardKit defines a bunch of keyboard-related colors.
- ๐ฑ Device Utilities - KeyboardKit has a bunch of device-specific utilities.
- ๐ค Dictation (BETA) - KeyboardKit can perform dictation from the keyboard.
- ๐ Emojis - KeyboardKit defines an emoji type with a lot of information.
- ๐ Feedback - KeyboardKit can trigger audio and haptic feedback.
- ๐ Gestures - KeyboardKit has rich, keyboard-specific gestures.
- ๐ผ๏ธ Images - KeyboardKit defines a bunch of keyboard-related images.
- ๐ฃ Layout - KeyboardKit defines dynamic input sets and keyboard layouts.
- ๐ Localization - KeyboardKit supports 63 locales.
- ๐บ๏ธ Navigation - KeyboardKit lets you open urls and other apps.
- ๐ Previews - KeyboardKit lets you preview views and components in SwiftUI.
- โก๏ธ Proxy Extensions - KeyboardKit makes
UITextDocumentProxy
do a LOT more. - โ๏ธ Settings - KeyboardKit has a bunch of settings tools.
- ๐ฉบ State - KeyboardKit lets you detect if a keyboard is enabled, has full access, etc.
- ๐จ Styling - KeyboardKit lets you style your keyboards to great extent.
- ๐ญ Themes - KeyboardKit Pro defines a theme engine with many predefined themes.
- ๐ Text Routing - KeyboardKit kan route text to other places.
KeyboardKit Pro extends KeyboardKit with a lot of Pro features, such as localized keyboards and services, autocomplete, autocorrect, dictation, emoji keyboards and features, themes, etc.
After installing KeyboardKit, just make your KeyboardViewController
inherit KeyboardInputViewController
instead of UIInputViewController
:
import KeyboardKit
class KeyboardController: KeyboardInputViewController {}
This gives your controller access to new lifecycle functions like viewWillSetupKeyboard
, observable state like state.keyboardContext
, services like services.actionHandler
, and much more.
KeyboardKit will use a SystemKeyboard
as the default keyboard view. To customize or replace it, override viewWillSetupKeyboard()
and call any setup
function with any custom view:
class KeyboardViewController: KeyboardInputViewControllerย {
override func viewWillSetupKeyboard() {
super.viewWillSetupKeyboard()
setup { controller in
SystemKeyboard(
state: controller.state,
services: controller.services,
buttonContent: { $0.view },
buttonView: { $0.view },
emojiKeyboard: { $0.view },
toolbar: { _ in MyCustomToolbar() }
)
}
}
}
For more information, please see the getting started guide.
The online documentation has more information, articles, code examples, etc.
The repository has a demo app that shows how to display keyboard state, link to system settings, etc.
The app has two keyboards:
Keyboard
uses KeyboardKit and a customizedSystemKeyboard
.KeyboardPro
uses KeyboardKit Pro and a customizedSystemKeyboard
with all locales, autocomplete, themes etc.
Just open and run the demo app in the Demo
folder, then enable the keyboards under System Settings. Note that you need to enable full access for some features, like haptic feedback.
If you want to try KeyboardKit Pro without having to write any code or build the demo app from Xcode, there KeyboardKit app in the App Store lets you try out many pro features.
KeyboardKit is open-source and completely free, but you can sponsor this project on GitHub Sponsors, upgrade to KeyboardKit Pro or get in touch for freelance work, paid support etc.
Feel free to reach out if you have questions or if you want to contribute in any way:
- Website: keyboardkit.com
- Mastodon: @[email protected]
- Twitter: @getkeyboardkit
- E-mail: [email protected]
KeyboardKit is available under the MIT license. See the LICENSE file for more info.