KeyboardKit is a SwiftUI SDK that lets you create fully customizable keyboard extensions with a few lines of code.
KeyboardKit extends Apple's limited keyboard APIs, extends the input controller and proxy with more capabilities, and provides you with additional functionality, states and views, to let you build an outstanding, custom keyboards.
KeyboardKit is open-source and completely free. It can be extended with KeyboardKit Pro to unlock Pro features, like localized keyboards, autocomplete & autocorrect, AI support, an emoji keyboard, themes, dictation, and more.
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.
To use KeyboardKit in a keyboard extension, just inherit the KeyboardKit 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.
If you just want to use the standard KeyboardView, which mimics a native iOS keyboard, you don't have to do anything else. KeyboardKit will set up an English keyboard for you.
To replace or customize the standard KeyboardView, just override viewWillSetupKeyboard and call setup with the view you want to use:
class KeyboardViewController: KeyboardInputViewControllerย {
override func viewWillSetupKeyboard() {
super.viewWillSetupKeyboard()
setup { [weak self] controller in // <-- Use [weak self] or [unowned self] if you need self here.
KeyboardView(
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.
KeyboardKit supports 68 keyboard-specific locales:
๐ฆ๐ฑ ๐ฆ๐ช ๐ฆ๐ฒ ๐ง๐พ ๐ง๐ฌ ๐ฆ๐ฉ ๐ณ๏ธ ๐ญ๐ท ๐จ๐ฟ ๐ฉ๐ฐ
๐ณ๐ฑ ๐ง๐ช ๐บ๐ธ ๐ฌ๐ง ๐บ๐ธ ๐ช๐ช ๐ซ๐ด ๐ต๐ญ ๐ซ๐ฎ ๐ซ๐ท
๐จ๐ฆ ๐ง๐ช ๐จ๐ญ ๐ฌ๐ช ๐ฉ๐ช ๐ฆ๐น ๐จ๐ญ ๐ฌ๐ท ๐บ๐ธ ๐ฎ๐ฑ
๐ญ๐บ ๐ฎ๐ธ ๐ณ๏ธ ๐ฎ๐ฉ ๐ฎ๐ช ๐ฎ๐น ๐ฐ๐ฟ ๐น๐ฏ ๐น๐ฏ ๐น๐ฏ
๐ฑ๐ป ๐ฑ๐น ๐ฒ๐ฐ ๐ฒ๐พ ๐ฒ๐น ๐ฒ๐ณ ๐ณ๏ธ ๐ณ๐ด ๐ณ๐ด ๐ฎ๐ท
๐ต๐ฑ ๐ต๐น ๐ง๐ท ๐ท๐ด ๐ท๐บ ๐ท๐ธ ๐ท๐ธ ๐ธ๐ฐ ๐ธ๐ฎ ๐ช๐ธ
๐ฆ๐ท ๐ฒ๐ฝ ๐ฐ๐ช ๐ธ๐ช ๐น๐ท ๐บ๐ฆ ๐บ๐ฟ ๐ด๓ ง๓ ข๓ ท๓ ฌ๓ ณ๓ ฟ
KeyboardKit only includes built-in support for English, whileย KeyboardKit Pro unlocks localized keyboards, layouts, callouts and behaviors for all supported locales.
KeyboardKit comes packed with free, open-source features to help you build amazing custom keyboards:
- โจ๏ธ Essentials - Essential utilities, models, services & views.
- ๐ฅ Actions - Trigger & handle keyboard-related actions.
- ๐ก Autocomplete - Perform autocomplete as the user types.
- ๐ฏ Callouts - Show input & secondary action callouts as the user types.
- ๐ฅ๏ธ Device - Identify the device type, device capabilities, etc.
- ๐ Emojis - Emojis, categories, versions, skin tones, etc.
- ๐ Feedback - Trigger audio & haptic feedback with ease.
- ๐ Gestures - Handle a rich set of gestures on any key.
- ๐ Host - Easily can identify the host application.
- ๐ฃ Layout - Easily define and customize the keyboard layout.
- ๐ Localization - Localize your keyboard in all supported locales.
- ๐บ๏ธ Navigation - Open urls and other apps from the keyboard.
- ๐ Previews - Extensive keyboard preview support.
- โก๏ธ Proxy - Extend the text document proxy with a lot more capabilities.
- โ๏ธ Settings - Easily provide in-app settings & link to System Settings.
- ๐ฉบ Status - Detect if a keyboard is enabled, has full access, etc.
- ๐จ Styling - Style your keyboard to great extent.
KeyboardKit Pro extends KeyboardKit with Pro features:
- โจ๏ธ Essentials - Unlock more essential tools, keyboard previews, etc.
- ๐ค AI - Unlock features that are needed for AI.
- ๐ฑ App - Unlock app-specific screens & views.
- ๐ก Autocomplete - Unlock on-device & remote autocomplete for many locales.
- ๐ฏ Callouts - Unlock localized callouts for all locales.
- ๐ค Dictation - Make your keyboard perform dictation via the main app.
- ๐ Emojis - Unlock a powerful emoji keyboard.
- โจ๏ธ External - Detect if an external keyboard is connected.
- ๐ Host - Easily identify and open specific host applications.
- ๐ฃ Layout - Unlock localized layouts for all locales.
- ๐ Localization - Unlock locale-specific services & views.
- ๐ Previews - Unlock keyboard & theme previews.
- โก๏ธ Proxy - Unlock ways for
UITextDocumentProxyto read the full document. - ๐ Text - Unlock tools to let users type within the keyboard.
- ๐ญ Themes - Unlock a theme engine with many pre-defined themes.
The online documentation has more information, articles, code examples, etc.
The demo app shows you how to customize the keyboard, show keyboard state, provide in-app settings in the main app, link to system settings, apply custom styles, etc.
The app has two keyboards - a Keyboard that uses KeyboardKit and a KeyboardPro that uses KeyboardKit Pro.
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 to work, like haptic feedback.
If you want to try KeyboardKit without having to write any code or build the demo app from Xcode, the KeyboardKit app lets you try out many features by just downloading it from the App Store.
KeyboardKit is open-source and completely free, but you can support the project by becoming a GitHub Sponsor, upgrading 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.