/KeyboardKit

KeyboardKit is a Swift SDK that lets you create fully customizable keyboards with a few lines of code, using SwiftUI.

Primary LanguageSwiftMIT LicenseMIT

KeyboardKit Logo

Version Swift 5.9 Swift UI MIT License Twitter: @@getkeyboardkit Mastodon: @keyboardkit@techhub.social

About KeyboardKit

KeyboardKit is a Swift SDK that lets you create fully customizable keyboards in a few lines of code, using SwiftUI.

KeyboardKit extends Apple's native APIs and provides you with a lot more functionality. It lets you mimic the native iOS keyboard and tweak its style and behavior, or create completely custom keyboards.

Custom iOS keyboard extensions can be used with all other apps that support text input. It's the only way for your product, brand or technology to directly interact with other apps on iOS. Don't miss out!

KeyboardKit can be used in different ways. Keyboard extensions can use it to create custom keyboards. Apps can use it to check keyboard state, full access, provide settings etc.

Installation

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.

Getting Started

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.

If you just want to use the default SystemKeyboard view, which mimics a native iOS keyboard and updates when the observable state changes, you don't have to do anything else. KeyboardKit will set up everything.

To replace or customize the default SystemKeyboard, just override viewWillSetupKeyboard and call setup:

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.

Supported Locales

KeyboardKit supports 63 keyboard-specific locales:

🇦🇱 🇦🇪 🇦🇲 🇧🇾 🇧🇬 🇦🇩 🏳️ 🇭🇷 🇨🇿 🇩🇰
🇳🇱 🇧🇪 🇺🇸 🇬🇧 🇺🇸 🇪🇪 🇫🇴 🇵🇭 🇫🇮 🇫🇷
🇧🇪 🇨🇭 🇬🇪 🇩🇪 🇦🇹 🇨🇭 🇬🇷 🇺🇸 🇮🇱 🇭🇺
🇮🇸 🏳️ 🇮🇩 🇮🇪 🇮🇹 🇰🇿 🇹🇯 🇹🇯 🇹🇯 🇱🇻
🇱🇹 🇲🇰 🇲🇾 🇲🇹 🇲🇳 🇳🇴 🏳️ 🇮🇷 🇵🇱 🇵🇹
🇧🇷 🇷🇴 🇷🇺 🇷🇸 🇷🇸 🇸🇰 🇸🇮 🇪🇸 🇰🇪 🇸🇪
🇹🇷 🇺🇦 🇺🇿

KeyboardKit provides a basic keyboard layout with basic callout actions. KeyboardKit Pro provides localized layouts, callouts and behaviors for all supported locales.

Features

KeyboardKit comes packed features to help you build amazing keyboard extensions:

  • ⌨️ Essentials - KeyboardKit comes with a bunch of essential features, types and views.
  • 💥 Actions - KeyboardKit makes it easy to trigger character insertion, locale switching, etc.
  • 🤖 AI Support - KeyboardKit has tools that are required for AI-based features.
  • 💡 Autocomplete - KeyboardKit can perform on-device and remote autocomplete & autocorrect.
  • 🗯 Callouts - KeyboardKit can show input and secondary action callouts.
  • 🌈 Colors - KeyboardKit defines keyboard-specific colors.
  • 📱 Device Utilities - KeyboardKit provides device-specific utilities.
  • 🎤 Dictation - KeyboardKit can perform dictation from the keyboard.
  • 😀 Emojis - KeyboardKit defines an emoji type, categories, an emoji keyboard, etc.
  • ⌨️ External Keyboards - KeyboardKit can detect and react to external keyboards.
  • 🔉 Feedback - KeyboardKit can trigger and customize audio and haptic feedback.
  • 👆 Gestures - KeyboardKit has rich, customizable keyboard-specific gestures.
  • 🖼️ Images - KeyboardKit defines keyboard-specific images.
  • 🔣 Layout - KeyboardKit defines dynamic input sets and customizable keyboard layouts.
  • 🌐 Localization - KeyboardKit supports 63 locales.
  • 🗺️ Navigation - KeyboardKit lets you open urls and other apps from the keyboard.
  • 👁 Previews - KeyboardKit has SwiftUI preview support and lets you show keyboard previews to your users.
  • ➡️ Proxy Extensions - KeyboardKit extends the native UITextDocumentProxy with a lot more capabilities.
  • ⚙️ Settings - KeyboardKit has a bunch of tools for managing in-app settings & System Settings.
  • 🩺 State - KeyboardKit lets you detect if a keyboard is enabled, has full access, etc.
  • 🎨 Styling - KeyboardKit provides pre-defined themes and lets you style your keyboards to great extent.
  • 🚏 Text Routing - KeyboardKit can route text input from the main app to in-keyboard textfields.

You can upgrade to KeyboardKit Pro to unlock Pro features like fully localized keyboards & services, autocomplete, an emoji keyboard, AI supporting capabilities, themes, dictation, and much more.

You can purchase a KeyboardKit Pro license from the KeyboardKit website.

Documentation

The online documentation has more information, articles, code examples, etc.

Demo App

The demo app shows how to display keyboard state, link to system settings, etc.

The demo app has two demo keyboards:

  • Keyboard uses KeyboardKit and a customized SystemKeyboard.
  • KeyboardPro uses KeyboardKit Pro and enables 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 to work.

KeyboardKit App

If you want to try KeyboardKit Pro without having to write any code or build the demo app from Xcode, there is a KeyboardKit app in the App Store, that lets you try out many pro features.

Support This Project

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.

Contact

Feel free to reach out if you have questions or if you want to contribute in any way:

License

KeyboardKit is available under the MIT license. See the LICENSE file for more info.