KeyboardKit lets you create custom keyboards with a few lines of code, using Swift & SwiftUI.
KeyboardKit lets you create amazing custom keyboard extensions with a few lines of code, using Swift & SwiftUI.
KeyboardKit extends Appleโs limited keyboard APIs with more capabilities. It can be extended with KeyboardKit Pro, which unlocks localized keyboards, autocomplete, an emoji keyboard, AI support, themes, and much more.
KeyboardKit can be installed with the Swift Package Manager:
https://github.com/KeyboardKit/KeyboardKit.git
The easiest way to set up KeyboardKit is to first create a KeyboardApp
value for your app:
extension KeyboardApp {
static var keyboardKitDemo: KeyboardApp {
.init(
name: "KeyboardKit",
licenseKey: "your-key-here", // Sets up KeyboardKit Pro!
appGroupId: "group.com.keyboardkit.demo", // Sets up App Group data sync
locales: .keyboardKitSupported, // Sets up the enabled locales
autocomplete: .init( // Sets up custom autocomplete
nextWordPredictionRequest: .claude(...) // Sets up AI-based prediction
),
deepLinks: .init(app: "kkdemo://", ...) // Defines how to open the app
)
}
}
Next, let your KeyboardController
inherit KeyboardInputViewController
instead of UIInputViewController
:
class KeyboardController: KeyboardInputViewController {}
This unlocks additional functions and capabilities, and injects services
and observable state
to the controller.
Next, override viewDidLoad()
and call setup(for:)
, or setupPro(for:)
if you use KeyboardKit Pro:
class KeyboardViewController: KeyboardInputViewControllerย {
override func viewDidLoad() {
super.viewDidLoad()
// KeyboardKit
setup(for: .keyboardKitDemo)
// ๐ KeyboardKit Pro
setup(for: .keyboardKitDemo) { result in
// If result is successful, KeyboardKit Pro is now active
// You can now customize your keyboard and tweak features
}
}
}
To replace or customize the standard KeyboardView
view, just override viewWillSetupKeyboardView()
and call setupKeyboardView(with:)
with the view that you want to use:
class KeyboardViewController: KeyboardInputViewControllerย {
override func viewWillSetupKeyboardView() {
setupKeyboardView { [weak self] controller in // <-- Use weak or unknowned self!
KeyboardView(
state: controller.state,
services: controller.services,
buttonContent: { $0.view },
buttonView: { $0.view },
collapsedView: { $0.view },
emojiKeyboard: { $0.view },
toolbar: { $0.view }
)
}
}
}
To set up your main app with the same keyboard configuration, just wrap the content view in a KeyboardAppView
:
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
KeyboardAppView(for: .keyboardKitDemo) {
ContentView()
}
}
}
}
For more information, see the getting started guide and essentials articles.
KeyboardKit supports 71 keyboard-specific locales:
๐บ๐ธ ๐ฆ๐ฑ ๐ฆ๐ช ๐ฆ๐ฒ ๐ง๐พ ๐ง๐ฌ ๐ฆ๐ฉ ๐ณ๏ธ ๐ณ๏ธ ๐ญ๐ท
๐จ๐ฟ ๐ฉ๐ฐ ๐ณ๐ฑ ๐ง๐ช ๐ฆ๐บ ๐จ๐ฆ ๐ฌ๐ง ๐บ๐ธ ๐ช๐ช ๐ซ๐ด
๐ต๐ญ ๐ซ๐ฎ ๐ซ๐ท ๐จ๐ฆ ๐ง๐ช ๐จ๐ญ ๐ฌ๐ช ๐ฉ๐ช ๐ฆ๐น ๐จ๐ญ
๐ฌ๐ท ๐บ๐ธ ๐ฎ๐ฑ ๐ญ๐บ ๐ฎ๐ธ ๐ณ๏ธ ๐ฎ๐ฉ ๐ฎ๐ช ๐ฎ๐น ๐ฐ๐ฟ
๐น๐ฏ ๐น๐ฏ ๐น๐ฏ ๐ฑ๐ป ๐ฑ๐น ๐ฒ๐ฐ ๐ฒ๐พ ๐ฒ๐น ๐ฒ๐ณ ๐ณ๏ธ
๐ณ๐ด ๐ณ๐ด ๐ฎ๐ท ๐ต๐ฑ ๐ต๐น ๐ง๐ท ๐ท๐ด ๐ท๐บ ๐ท๐ธ ๐ท๐ธ
๐ธ๐ฐ ๐ธ๐ฎ ๐ช๐ธ ๐ฆ๐ท ๐ฒ๐ฝ ๐ธ๐ช ๐ฐ๐ช ๐น๐ท ๐บ๐ฆ ๐บ๐ฟ
๐ด๓ ง๓ ข๓ ท๓ ฌ๓ ณ๓ ฟ
KeyboardKit only includes localized strings, whileย KeyboardKit Pro unlocks localized keyboards, layouts, callouts and behaviors for all supported locales.
KeyboardKit provides a free, open-source keyboard engine. KeyboardKit Pro unlocks more powerful pro features.
UITextDocumentProxy
to read the full document.The online documentation has a thorough getting-started guide, a detailed article for each feature, code samples, etc. You can also build it from the source code to get better formatting.
The Demo
folder has a demo app that shows how to set up the main keyboard app, show keyboard status, provide in-app settings, 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.
[!IMPORTANT]
The demo isnโt code signed and can therefore not use an App Group to sync settings between the app and its keyboards. As such, theKeyboardPro
keyboard has keyboard settings in the keyboard as well.
Download the KeyboardKit app from the App Store to try KeyboardKit without having to write any code or build the demo app from Xcode.
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:
KeyboardKit is available under the MIT license. See the LICENSE file for more info.