Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/keyboardkit/keyboardkit

KeyboardKit lets you create custom keyboards with a few lines of code, using Swift & SwiftUI.
https://github.com/keyboardkit/keyboardkit

apple emoji ios keyboard keyboard-extension macos swift swiftui tvos visionos watchos

Last synced: 6 days ago
JSON representation

KeyboardKit lets you create custom keyboards with a few lines of code, using Swift & SwiftUI.

Awesome Lists containing this project

README

        


KeyboardKit Logo


Version
Swift 5.9
MIT License
Documentation

## About KeyboardKit

KeyboardKit is a SwiftUI SDK that lets you create fully customizable [keyboard extensions][About] with a few lines of code.

KeyboardKit extends Apple's limited keyboard APIs with more capabilities, and provides additional functionality, to let you build outstanding custom keyboards with little effort.



KeyboardKit is open-source and completely free. It can be extended with [KeyboardKit Pro][Pro] to unlock Pro features, like localized keyboards, autocomplete & autocorrect, AI support, an emoji keyboard, themes, dictation, and more.

## Installation

KeyboardKit can be installed with the Swift Package Manager:

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

## Getting Started

To use KeyboardKit in a keyboard extension, just import `KeyboardKit` and let your `KeyboardController` inherit ``KeyboardInputViewController`` instead of `UIInputViewController`:

```swift
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 create a `KeyboardApp` value that defines information for your app:

```swift
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` value:

```swift
class KeyboardViewController: KeyboardInputViewControllerย {

override func viewDidLoad() {
super.viewDidLoad()
setup(for: .keyboardKitDemo)
}
}
```

To replace or customize the standard `KeyboardView` keyboard, just override `viewWillSetupKeyboardView` and call `setupKeyboardView` with the view you want to use:

```swift
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 },
collapsedView: { $0.view },
emojiKeyboard: { $0.view },
toolbar: { _ in MyCustomToolbar() }
)
}
}
}
```

To set up your main app with the same configuration, just wrap the root content view in a `KeyboardAppView`:

```swift
import SwiftUI
import KeyboardKit

@main
struct MyApp: App {

var body: some Scene {
WindowGroup {
KeyboardAppView(for: .keyboardKitDemo) {
ContentView()
}
}
}
}
```

Setting up your app and keyboard with a `KeyboardApp` will make settings sync between the two if an ``appGroupId`` is defined, register your KeyboardKit Pro license if a ``licenseKey`` is defined, set up dictation, deep links, etc.

For more information, see the [getting started guide][Getting-Started].

## Localization

KeyboardKit supports [71 keyboard-specific locales][Localization]:

๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ฆ๐Ÿ‡ฑ ๐Ÿ‡ฆ๐Ÿ‡ช ๐Ÿ‡ฆ๐Ÿ‡ฒ ๐Ÿ‡ง๐Ÿ‡พ ๐Ÿ‡ง๐Ÿ‡ฌ ๐Ÿ‡ฆ๐Ÿ‡ฉ ๐Ÿณ๏ธ ๐Ÿณ๏ธ ๐Ÿ‡ญ๐Ÿ‡ท

๐Ÿ‡จ๐Ÿ‡ฟ ๐Ÿ‡ฉ๐Ÿ‡ฐ ๐Ÿ‡ณ๐Ÿ‡ฑ ๐Ÿ‡ง๐Ÿ‡ช ๐Ÿ‡ฆ๐Ÿ‡บ ๐Ÿ‡จ๐Ÿ‡ฆ ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ช๐Ÿ‡ช ๐Ÿ‡ซ๐Ÿ‡ด

๐Ÿ‡ต๐Ÿ‡ญ ๐Ÿ‡ซ๐Ÿ‡ฎ ๐Ÿ‡ซ๐Ÿ‡ท ๐Ÿ‡จ๐Ÿ‡ฆ ๐Ÿ‡ง๐Ÿ‡ช ๐Ÿ‡จ๐Ÿ‡ญ ๐Ÿ‡ฌ๐Ÿ‡ช ๐Ÿ‡ฉ๐Ÿ‡ช ๐Ÿ‡ฆ๐Ÿ‡น ๐Ÿ‡จ๐Ÿ‡ญ

๐Ÿ‡ฌ๐Ÿ‡ท ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ฎ๐Ÿ‡ฑ ๐Ÿ‡ญ๐Ÿ‡บ ๐Ÿ‡ฎ๐Ÿ‡ธ ๐Ÿณ๏ธ ๐Ÿ‡ฎ๐Ÿ‡ฉ ๐Ÿ‡ฎ๐Ÿ‡ช ๐Ÿ‡ฎ๐Ÿ‡น ๐Ÿ‡ฐ๐Ÿ‡ฟ

๐Ÿ‡น๐Ÿ‡ฏ ๐Ÿ‡น๐Ÿ‡ฏ ๐Ÿ‡น๐Ÿ‡ฏ ๐Ÿ‡ฑ๐Ÿ‡ป ๐Ÿ‡ฑ๐Ÿ‡น ๐Ÿ‡ฒ๐Ÿ‡ฐ ๐Ÿ‡ฒ๐Ÿ‡พ ๐Ÿ‡ฒ๐Ÿ‡น ๐Ÿ‡ฒ๐Ÿ‡ณ ๐Ÿณ๏ธ

๐Ÿ‡ณ๐Ÿ‡ด ๐Ÿ‡ณ๐Ÿ‡ด ๐Ÿ‡ฎ๐Ÿ‡ท ๐Ÿ‡ต๐Ÿ‡ฑ ๐Ÿ‡ต๐Ÿ‡น ๐Ÿ‡ง๐Ÿ‡ท ๐Ÿ‡ท๐Ÿ‡ด ๐Ÿ‡ท๐Ÿ‡บ ๐Ÿ‡ท๐Ÿ‡ธ ๐Ÿ‡ท๐Ÿ‡ธ

๐Ÿ‡ธ๐Ÿ‡ฐ ๐Ÿ‡ธ๐Ÿ‡ฎ ๐Ÿ‡ช๐Ÿ‡ธ ๐Ÿ‡ฆ๐Ÿ‡ท ๐Ÿ‡ฒ๐Ÿ‡ฝ ๐Ÿ‡ธ๐Ÿ‡ช ๐Ÿ‡ฐ๐Ÿ‡ช ๐Ÿ‡น๐Ÿ‡ท ๐Ÿ‡บ๐Ÿ‡ฆ ๐Ÿ‡บ๐Ÿ‡ฟ

๐Ÿด๓ ง๓ ข๓ ท๓ ฌ๓ ณ๓ ฟ

KeyboardKit only includes localized strings, whileย [KeyboardKit Pro][Pro] unlocks localized keyboards, layouts, callouts and behaviors for all supported locales.

## Features

KeyboardKit is packed with features to help you build amazing custom keyboards:

* โŒจ๏ธ [Essentials][Essentials] - Essential keyboard utilities, models, services & views.
* ๐Ÿ’ฅ [Actions][Actions] - Trigger & handle keyboard-related actions.
* ๐Ÿ“ฑ [App][App] - Define and set up your app, settings, etc.
* ๐Ÿ’ก [Autocomplete][Autocomplete] - Perform autocomplete as the user types.
* ๐Ÿ—ฏ [Callouts][Callouts] - Show input & secondary action callouts.
* ๐Ÿ–ฅ๏ธ [Device][Device] - Identify device type, device capabilities, etc.
* ๐Ÿ˜€ [Emojis][Emojis] - Emojis, categories, versions, skin tones, etc.
* ๐Ÿ”‰ [Feedback][Feedback] - Trigger audio & haptic feedback with ease.
* ๐Ÿ‘† [Gestures][Gestures] - Handle a rich set of gestures on any key.
* ๐Ÿ”ฃ [Layout][Layout] - Define and customize dynamic keyboard layouts.
* ๐ŸŒ [Localization][Localization] - Localize your keyboard in **71 locales**.
* ๐Ÿ—บ๏ธ [Navigation][Navigation] - Open urls and other apps from the keyboard.
* ๐Ÿ‘ [Previews][Previews] - Extensive SwiftUI preview support.
* ๐Ÿ“„ [Proxy][Proxy] - Extend the text document proxy with more capabilities.
* โš™๏ธ [Settings][Settings] - Provide keyboard settings & link to System Settings.
* ๐Ÿฉบ [Status][Status] - Detect if a keyboard is enabled, has full access, etc.
* ๐ŸŽจ [Styling][Styling] - Style your keyboard to great extent.

## ๐Ÿ‘‘ Pro Features

[KeyboardKit Pro][Pro] extends KeyboardKit with Pro features:

* โŒจ๏ธ [Essentials][Essentials] - More essential tools, previews, toolbars, etc.
* ๐Ÿค– [AI][AI] - Features that are needed for AI.
* ๐Ÿ“ฑ [App][App] - App-specific screens & views.
* ๐Ÿ’ก [Autocomplete][Autocomplete] - Local & remote autocomplete, next word prediction, etc.
* ๐Ÿ—ฏ [Callouts][Callouts] - Localized callout actions for all supported locales.
* ๐ŸŽค [Dictation][Dictation] - Dictate text from the keyboard.
* ๐Ÿ˜€ [Emojis][Emojis] - A powerful emoji keyboard, search, etc.
* โŒจ๏ธ [External][External] - Auto-detect if an external keyboard is connected.
* ๐Ÿ  [Host][Host] - Identify and open specific host applications.
* ๐Ÿ”ฃ [Layout][Layout] - Localized layouts for all supported locales.
* ๐ŸŒ [Localization][Localization] - Services & views for all supported locales.
* ๐Ÿ‘ [Previews][Previews] - Keyboard & theme previews for in-app use.
* ๐Ÿ“„ [Proxy][Proxy] - Allow `UITextDocumentProxy` to read the full document.
* ๐Ÿ“ [Text][Text-Input] - Allow users to type within the keyboard.
* ๐Ÿญ [Themes][Themes] - A theme engine with many pre-defined themes.

## Documentation

The [online documentation][Documentation] has a detailed article for each feature, a thorough getting-started guide, code samples, etc. You can also build it from the source code to get better formatting.

## Demo App

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 use an App Group to sync settings between the app and its keyboards. As such, the `KeyboardPro` keyboard has settings screens in the keyboard as well.

## KeyboardKit App

If you want to try KeyboardKit without having to write any code or build the demo app from Xcode, the [KeyboardKit app][KeyboardKit-App] lets you try out many features by just downloading it from the App Store.

## Support This Project

KeyboardKit is open-source and completely free, but you can support the project by becoming a [GitHub Sponsor][Sponsors], upgrading to [KeyboardKit Pro][Pro] or [get in touch][Email] 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:

* Website: [keyboardkit.com][Website]
* Mastodon: [@[email protected]][Mastodon]
* Twitter: [@getkeyboardkit][Twitter]
* E-mail: [[email protected]][Email]

## License

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

[Email]: mailto:[email protected]
[Website]: https://keyboardkit.com
[Twitter]: http://twitter.com/getkeyboardkit
[Mastodon]: https://techhub.social/@keyboardkit
[Sponsors]: https://github.com/sponsors/danielsaidi

[About]: https://keyboardkit.com/about

[KeyboardKit]: https://github.com/KeyboardKit/KeyboardKit
[KeyboardKit-App]: https://keyboardkit.com/app
[Pro]: https://github.com/KeyboardKit/KeyboardKitPro
[Gumroad]: https://kankoda.gumroad.com
[License]: https://github.com/KeyboardKit/KeyboardKit/blob/master/LICENSE

[Documentation]: https://keyboardkit.github.io/KeyboardKit/
[Getting-Started]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/getting-started-article
[Essentials]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/essentials-article

[Actions]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/actions-article
[AI]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/ai-article
[App]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/app-article
[Autocomplete]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/autocomplete-article
[Buttons]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/buttons-article
[Callouts]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/callouts-article
[Device]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/device-article
[Dictation]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/dictation-article
[Emojis]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/emojis-article
[External]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/external-keyboards-article
[Feedback]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/feedback-article
[Gestures]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/gestures-article
[Host]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/host-article
[Layout]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/layout-article
[Localization]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/localization-article
[Navigation]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/navigation-article
[Previews]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/previews-article
[Proxy]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/proxy-article
[Settings]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/settings-article
[Status]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/status-article
[Styling]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/styling-article
[Text-Input]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/text-input-article
[Themes]: https://keyboardkit.github.io/KeyboardKit/documentation/keyboardkit/themes-article