Custom keyboard extensions on iOS are notoriously tricky to build and maintain. Apple’s platform imposes strict limitations on keyboard extensions, and managing state synchronization between the keyboard and its host app can become a complex chore. KeyboardKit addresses these pain points with a Swift framework that extends the native keyboard controller, adds built-in support for autocomplete (including AI-powered prediction), locale management, and app group data syncing.
How KeyboardKit structures iOS keyboard extensions
KeyboardKit is delivered as a binary Swift framework installable through Swift Package Manager. It’s designed to be linked only to the main app target while remaining accessible to other targets without additional linking. This approach helps keep the app’s build clean and avoids redundant framework linking.
Central to the framework is the KeyboardInputViewController class, which subclasses Apple’s native UIInputViewController. By inheriting from KeyboardInputViewController, developers unlock additional capabilities such as observable keyboard state and a services property that centralizes common keyboard-related functionalities.
The framework introduces a single configuration struct called KeyboardApp. This struct encapsulates key settings such as the app’s name, license key (required for KeyboardKit Pro features), app group identifier (for enabling data sync between the keyboard and main app), supported locales, autocomplete settings, and deep link schemes. This centralized configuration pattern simplifies managing keyboard behavior consistently across the app and extension.
In addition to standard autocomplete, KeyboardKit supports advanced AI-based next-word prediction by integrating with language models like Claude. Developers can configure AI prediction requests as part of the autocomplete setup, enabling smarter and more context-aware typing suggestions.
Extending Apple’s keyboard APIs: technical strengths and tradeoffs
KeyboardKit stands out by extending Apple’s limited keyboard extension APIs with a richer, more developer-friendly interface. The KeyboardInputViewController class adds observable state and centralized services, which significantly improve the developer experience (DX) when building custom keyboards.
The framework’s binary distribution via Swift Package Manager ensures easy integration without bloating the app. However, it requires linking only in the main app target, which is a clear tradeoff developers must manage in multi-target projects.
The use of a configuration struct (KeyboardApp) to consolidate settings is a clean, opinionated convention that reduces boilerplate and potential configuration drift. This pattern provides a single source of truth for keyboard behavior, locales, autocomplete, and deep link handling.
Supporting AI-based autocomplete is a notable strength. While this feature depends on external AI services (e.g., Claude) and network requests, it demonstrates how KeyboardKit integrates modern predictive typing capabilities without forcing developers to build these from scratch.
The framework also handles app group data syncing, which is crucial for maintaining consistent keyboard settings and learned data across the main app and keyboard extension. This is a common pain point in iOS keyboard development that KeyboardKit addresses out of the box.
On the downside, the framework’s reliance on a binary distribution means developers cannot easily inspect or customize internal implementation. Also, the AI autocomplete integration introduces external dependencies and potential latency, which developers need to consider for offline or privacy-sensitive scenarios.
Quick start with KeyboardKit
KeyboardKit provides clear installation and setup instructions directly in its README.
Install via Swift Package Manager by adding the following to your package dependencies:
https://github.com/KeyboardKit/KeyboardKit.git
Since KeyboardKit is a binary framework, link it only to your main app target. Other targets can use it without linking.
Next, create a KeyboardApp configuration struct for your app. This example configures the app with a license key, app group ID for data syncing, supported locales, AI-powered autocomplete, and deep links:
import KeyboardKit
extension KeyboardApp {
static var keyboardKitDemo: KeyboardApp {
.init(
name: "KeyboardKit",
licenseKey: "your-key-here", // Needed for 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
)
}
}
Then, make your KeyboardController subclass KeyboardInputViewController instead of UIInputViewController:
class KeyboardController: KeyboardInputViewController {}
This unlocks the additional framework capabilities such as observable state and services.
Finally, override viewDidLoad() and call setup(for:) passing your KeyboardApp configuration:
class KeyboardViewController: KeyboardInputViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Set up the keyboard with the app configuration
setup(for: .keyboardKitDemo) { result in
// Handle setup result here
if case .success = result {
// Setup succeeded, customize services if needed
}
}
}
}
This wiring handles syncing settings between your app and keyboard extension and activates autocomplete and locale support.
Verdict: who should consider KeyboardKit?
KeyboardKit is a solid choice if you’re building custom iOS keyboard extensions and want to avoid the usual boilerplate and complexity around state synchronization and autocomplete. It extends Apple’s native keyboard APIs in a pragmatic way that improves developer experience and adds useful features like AI-powered autocomplete and app group syncing.
The tradeoff is that KeyboardKit is a binary framework, so you’re limited in customizing internals. Also, AI autocomplete may require extra setup and consideration around privacy and offline use.
If you’re comfortable with Swift and iOS development and need a structured, maintainable way to build a feature-rich keyboard extension, KeyboardKit is worth evaluating. It’s especially relevant if you want to add advanced autocomplete and locale management without building those systems from scratch.
For simple keyboards or projects where you want full control over every detail of implementation, a lighter-weight or fully open-source approach might suit better. But for many real-world apps, KeyboardKit’s conventions and integrations reduce friction and accelerate development.
→ GitHub Repo: KeyboardKit/KeyboardKit ⭐ 1,825 · Swift