/KeyboardKit

KeyboardKit helps you create custom keyboards with Swift and SwiftUI.

Primary LanguageSwiftMIT LicenseMIT

KeyboardKit Logo

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

About KeyboardKit

KeyboardKit helps you create custom keyboard extensions with Swift and SwiftUI.

KeyboardKit extends Apple's native APIs and provides you with a lot more functionality. It lets you create custom keyboards that mimic native iOS keyboards with just a few lines of code.

KeyboardKit supports custom input keys, layout, design, behavior, etc. You can even use completely custom views.

Installation

KeyboardKit can be installed with the Swift Package Manager:

https://github.com/KeyboardKit/KeyboardKit.git

KeyboardKit supports iOS, macOS, tvOS and watchOS, but some features are unavailable on some platforms.

Supported Locales

KeyboardKit supports 63 keyboard-specific locales:

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

KeyboardKit provides basic input sets, keyboard layouts and callout actions, while KeyboardKit Pro provides localized variants 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 and types.
  • 💥 Actions - KeyboardKit has keyboard actions like characters, actions, etc.
  • 🤖 AI Support - KeyboardKit has capabilities that are needed for AI.
  • 💡 Autocomplete - KeyboardKit can perform autocomplete and autocorrect.
  • 🔤 Buttons - KeyboardKit can style any view as a keyboard button.
  • 🗯 Callouts - KeyboardKit can show input and secondary callouts.
  • 🌈 Colors - KeyboardKit defines a bunch of keyboard-related colors.
  • 📱 Device Utilities - KeyboardKit has a bunch of device-specific utilities.
  • 🎤 Dictation (BETA) - KeyboardKit can perform dictation from the keyboard.
  • 😀 Emojis - KeyboardKit defines an emoji type with a lot of information.
  • 🔉 Feedback - KeyboardKit can trigger audio and haptic feedback.
  • 👆 Gestures - KeyboardKit has rich, keyboard-specific gestures.
  • 🖼️ Images - KeyboardKit defines a bunch of keyboard-related images.
  • 🔣 Layout - KeyboardKit defines dynamic input sets and keyboard layouts.
  • 🌐 Localization - KeyboardKit supports 63 locales.
  • 🗺️ Navigation - KeyboardKit lets you open urls and other apps.
  • 👁 Previews - KeyboardKit lets you preview views and components in SwiftUI.
  • ➡️ Proxy Extensions - KeyboardKit makes UITextDocumentProxy do a LOT more.
  • ⚙️ Settings - KeyboardKit has a bunch of settings tools.
  • 🩺 State - KeyboardKit lets you detect if a keyboard is enabled, has full access, etc.
  • 🎨 Styling - KeyboardKit lets you style your keyboards to great extent.
  • 🚏 Text Routing - KeyboardKit kan route text to other places.

KeyboardKit Pro extends KeyboardKit with a lot of Pro features, such as localized keyboards and services, autocomplete, autocorrect, dictation, emoji keyboards and features, themes, etc.

Getting Started

After installing KeyboardKit, just import it and make your controller inherit KeyboardInputViewController instead of UIInputViewController:

import KeyboardKit

class KeyboardController: KeyboardInputViewController {}

This gives your controller access to new lifecycle functions, observable state, services, and much more.

You can then override viewWillSetupKeyboard() and call any of the setup functions to customize or replace the standard SystemKeyboard view:

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.

Documentation

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

Demo App

The repository has a demo app that shows how to display keyboard state, link to system settings, etc.

The demo app has two keyboards:

  • Keyboard uses KeyboardKit and a customized SystemKeyboard.
  • KeyboardPro uses KeyboardKit Pro and a customized SystemKeyboard with 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, like haptic feedback.

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 sponsor this project on GitHub Sponsors, upgrade 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.