KeyboardKit is a Swift SDK that lets you create fully customizable keyboards with a few lines of code, using SwiftUI.
MIT License
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 import KeyboardKit
and let your KeyboardViewController
inherit KeyboardInputViewController
instead of UIInputViewController
:
import KeyboardKit
class KeyboardController: KeyboardInputViewController {}
This gives you access to lifecycle functions like viewWillSetupKeyboardView
, observable state, services, etc.
The easiest way to set up KeyboardKit is to use create a KeyboardApp
value to define information for your app:
extension KeyboardApp {
static var keyboardKitDemo: Self {
.init(
name: "KeyboardKit",
licenseKey: "keyboardkitpro-license-key",
bundleId: "com.keyboardkit.demo",
appGroupId: "group.com.keyboardkit.demo",
deepLinks: .init(app: "kkdemo://")
)
}
}
To set up your keyboard, just override viewDidLoad
and call setup(for:)
with your KeyboardApp
:
class KeyboardViewController: KeyboardInputViewControllerย {
override func viewDidLoad() {
super.viewDidLoad()
setup(for: .keyboardKitDemo)
}
}
This will make KeyboardSettings
sync data between the main app and its keyboard if an appGroupId
is defined, register a KeyboardKit Pro license if a licenseKey
is defined, set up dictation, deep links, etc.
To replace or customize the standard, English KeyboardView
, just override viewWillSetupKeyboardView
and call setupKeyboardView
with the view you want to use:
class KeyboardViewController: KeyboardInputViewControllerย {
override func viewWillSetupKeyboardView() {
super.viewWillSetupKeyboardView()
setupKeyboardView { [weak self] controller in // <-- Use weak or unknowned self!
KeyboardView(
state: controller.state,
services: controller.services,
buttonContent: { $0.view },
buttonView: { $0.view },
emojiKeyboard: { $0.view },
toolbar: { _ in MyCustomToolbar() }
)
}
}
}
To set up the main app with the same configuration as the keyboard extension, just wrap the main content view in a KeyboardAppView
and provide it with the same app information:
import SwiftUI
import KeyboardKit
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
KeyboardAppView(for: .keyboardKitDemo) {
ContentView()
}
}
}
}
This will make KeyboardSettings
sync data between the main app and its keyboard if an appGroupId
is defined, register a KeyboardKit Pro license if a licenseKey
is defined, set up dictation, deep links, etc.
For more information, please see the getting started guide.
KeyboardKit supports 68 keyboard-specific locales:
๐ฆ๐ฑ ๐ฆ๐ช ๐ฆ๐ฒ ๐ง๐พ ๐ง๐ฌ ๐ฆ๐ฉ ๐ณ๏ธ ๐ญ๐ท ๐จ๐ฟ ๐ฉ๐ฐ ๐ณ๐ฑ ๐ง๐ช ๐บ๐ธ ๐ฌ๐ง ๐บ๐ธ ๐ช๐ช ๐ซ๐ด ๐ต๐ญ ๐ซ๐ฎ ๐ซ๐ท ๐จ๐ฆ ๐ง๐ช ๐จ๐ญ ๐ฌ๐ช ๐ฉ๐ช ๐ฆ๐น ๐จ๐ญ ๐ฌ๐ท ๐บ๐ธ ๐ฎ๐ฑ ๐ญ๐บ ๐ฎ๐ธ ๐ณ๏ธ ๐ฎ๐ฉ ๐ฎ๐ช ๐ฎ๐น ๐ฐ๐ฟ ๐น๐ฏ ๐น๐ฏ ๐น๐ฏ ๐ฑ๐ป ๐ฑ๐น ๐ฒ๐ฐ ๐ฒ๐พ ๐ฒ๐น ๐ฒ๐ณ ๐ณ๏ธ ๐ณ๐ด ๐ณ๐ด ๐ฎ๐ท ๐ต๐ฑ ๐ต๐น ๐ง๐ท ๐ท๐ด ๐ท๐บ ๐ท๐ธ ๐ท๐ธ ๐ธ๐ฐ ๐ธ๐ฎ ๐ช๐ธ ๐ฆ๐ท ๐ฒ๐ฝ ๐ฐ๐ช ๐ธ๐ช ๐น๐ท ๐บ๐ฆ ๐บ๐ฟ ๐ด๓ ง๓ ข๓ ท๓ ฌ๓ ณ๓ ฟ
KeyboardKit only includes localized strings, whileย KeyboardKit Pro unlocks localized keyboards, layouts, callouts and behaviors for all supported locales.
KeyboardKit is packed with features to help you build amazing custom keyboards:
KeyboardKit Pro extends KeyboardKit with Pro features:
UITextDocumentProxy
read the full document.The online documentation has more information, getting-started guides, articles, code examples, etc.
[!NOTE] The documentation is updated for KeyboardKit 8.9. This also adjusts it for Xcode 16, which makes native type extension links fail to resolve for GitHub Actions, which currently uses Xcode 15.
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. Note that you need to enable Full Access for some features to work, like haptic feedback.
[!IMPORTANT] The demo isn't code signed, and can therefore not sync settings between the app and its keyboards. As such, the
KeyboardPro
keyboard has the same settings screens to provide in-keyboard settings.
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:
KeyboardKit is available under the MIT license. See the LICENSE file for more info.