GitHub - amti7/KeyboardKit: KeyboardKit is a Swift library that helps you create custom keyboard extensions for iOS and ipadOS. · GitHub
Skip to content

amti7/KeyboardKit

 
 

Repository files navigation

KeyboardKit

Version Platform Swift 5.3 MIT License Twitter: @danielsaidi

About KeyboardKit

KeyboardKit helps you build custom keyboard extensions for iOS and iPadOS using SwiftUI.

KeyboardKit extends the native keyboard extension APIs to provide you with a lot more functionality. It also provides you with views and utils to help mimic native keyboards, with support for multiple locales, gestures, callouts etc.

The end result can look something like this...or entirely different:

KeyboardKit doesn't force your keyboard to use a specific look or behavior. You can customize the look of the native keyboard freely or use a completely different design.

If you're new to iOS keyboard extensions, this great guide will help you get started. You can also have a look at the demo app for inspiration.

Installation

The best way to add KeyboardKit to your app is to use the Swift Package Manager:

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

You can add the library to the main app, the keyboard extension and any other targets that needs it.

Getting started

Once KeyboardKit is added to your project, you can start using it in your application and keyboard extension.

  • The main app can use KeyboardKit to check if a keyboard is enabled, if full access is granted etc. which helps you build a more helpful application.
  • The main app can also use the various utils and views to mimic keyboards within the app itself.
  • The keyboard extension can use KeyboardKit to build more powerful custom keyboard functionality.

In your extension, let your KeyboardViewController inherit KeyboardKit's KeyboardInputViewController instead of UIInputViewController. This gives it access to a lot of additional functionality, observables like keyboardContext, services like keyboardActionHandler, keyboardAppearance, autocomplete etc.

KeyboardInputViewController will call viewWillSetupKeyboard when the keyboard should be created or re-created. You can use setup(with:) to setup your extension with any SwiftUI view, to inject necessary environment objects, resize the keyboard extension to fit the view etc.

Have a look at the demo application and read more below to see how it all fits together.

Documentation

The KeyboardKit documentation makes it easy to overview the various parts of the library.

Just build the documentation directly in Xcode, using the "Product/Build Documentation" command.

🇸🇪 Localization

KeyboardKit is localized in the following languages:

  • 🇺🇸 English

  • 🇦🇱 Albanian

  • 🇩🇰 Danish

  • 🇳🇱 Dutch

  • 🇬🇧 English (UK)

  • 🇺🇸 English (US)

  • 🇪🇪 Estonian

  • 🇫🇮 Finnish

  • 🇫🇷 French

  • 🇩🇪 German

  • 🇮🇸 Icelandic

  • 🇮🇹 Italian

  • 🇱🇻 Latvian

  • 🇱🇹 Lithuanian

  • 🇳🇴 Norwegian

  • 🇵🇱 Polish

  • 🇷🇺 Russian

  • 🇪🇸 Spanish

  • 🇸🇪 Swedish

  • 🇺🇦 Ukrainian

KeyboardKit also supports localized keyboards, where the keyboard layout, secondary actions etc. behave just like they should for a certain locale.

Read more here

Features

Even though KeyboardKit contains a lot of features, you can use its' extensions and views alone to simplify working with keyboard extensions. For instance, there are a bunch of UITextDocumentProxy extensions that make your life easier, and views that don't require you to use the rest of the library.

Check out the demo apps and source code for examples and more information.

💥 Actions

KeyboardKit comes with many keyboard-specific actions, like character inputs, emojis, backspace, space, newline, image etc. You can even create your own actions.

Read more here

🎨 Appearance

KeyboardKit comes with an appearance engine that lets you easily style your keyboards.

Read more here

🔊 Audio

KeyboardKit defines system audio types and ways to play them.

Read more here

💡Autocomplete

KeyboardKit can present autocomplete suggestions as users type.

Read more here

🗯 Callouts

KeyboardKit lets you show input callouts as users type, as well as secondary action callouts with secondary input actions.

Read more here

😊 Emojis

KeyboardKit defines emojis and emoji categories that you can use in your own keyboards.

Read more here

🧩 Extensions

KeyboardKit provides a bunch of extensions to native types.

Read more here

⌨️ External Keyboards

KeyboardKit lets you detect whether or not an external keyboard is used.

Read more here

👋 Feedback

KeyboardKit keyboards can give audio and haptic feedback as users type.

Read more about audio feedback and haptic feedback.

👆 Gestures

KeyboardKit comes with keyboard-specific gestures that you can use in your own keyboards.

Read more here

👋 Haptics

KeyboardKit defines haptic feedback types and ways to trigger them.

Read more here

🔤 Input

KeyboardKit comes with an input set engine that make it easy to create alphabetic, numeric and symbolic keyboards in different languages.

Read more here

⌨️ Keyboard Layouts

KeyboardKit comes with a layout engine that makes it easy to create specific keyboard layouts for various devices, orientations and locales.

Read more here

💱 Keyboard Types

KeyboardKit comes with many different keyboard types, like alphabetic, numeric, symbolic, emoji etc. You can even create your own types.

Read more here

🌐 Locales

KeyboardKit defines keyboard-specific locales and provides localized content for the supported locales.

[Read more here][Locales]

👁 Previews

KeyboardKit defines a bunch of preview-specific types that simplify previewing keyboard views in SwiftUI.

Read more here

➡️ Proxy

KeyboardKit defines a bunch of extensions to UITextDocumentProxy and ways to route text to other sources.

Read more here

🎨 Styles

KeyboardKit defines a bunch of styles that simplify customizing the look of various keyboard components and buttons.

Read more here

🖼 Views

KeyboardKit comes with a bunch of keyboard-specific views:

  • Autocomplete contains autocomplete toolbars and toolbar items.
  • Callouts contains input and secondary input callout views.
  • Emojis contains various emoji keyboards and keyboard components.
  • Input contains text inputs that can be used in a keyboard extension.
  • System contains views that can be used to mimic native systme keyboards.
  • KeyboardGrid can be used to evenly space a set of views in a grid.
  • NextKeyboardButton can be used to switch to the next keyboard.

You can also use these views without using the rest of KeyboardKit.

Demo Application

This repository contains a demo app that demonstrates different keyboards, like alphabetical (lowercased, uppercased and capslocked), numerical, symbols, emojis and images.

The demo app is not intended to be production ready, but rather to give you inspiration to how you can build your own keyboards. Just keep in mind that your keyboards can look anyway you like. They don't have to look like a system keyboard.

To run the demo app, open and run the Demo/Demo.xcodeproj project, then enable the keyboards under system settings. Enable full access to support all features, like audio and haptic feedback.

Note that you may have to update the KeyboardKit dependencies for the demo to run. If so, you can do that under File/Swift Packages/Update to Latest Package Versions.

KeyboardKit Pro

KeyboardKit Pro is a license-based extensions that unlocks pro features, such as additional locales, autocomplete implementation, convenience views etc. It can save you a lot of time when developing more complex keyboards.

KeyboardKit Pro is also a way to support this project, which is completely free and developed by a single person (with great help from the community). If you appreciate this project, consider going Pro.

Note that KeyboardKit Pro extends this library by using the same extension points as is available to everyone.

Go Pro here!

Contact

KeyboardKit is developed by Daniel Saidi, with great help from the community.

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

Sponsors and Clients

This project is proudly sponsored by the following companies:

Oribi Logo Anomaly Software Logo Milo Creative Logo phonetoroam Logo

You can support KeyboardKit by sponsoring the project on GitHub Sponsors, signing up for a KeyboardKit Pro license or hiring me for consultation.

License

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

About

KeyboardKit is a Swift library that helps you create custom keyboard extensions for iOS and ipadOS.

Resources

License

Stars

Watchers

Forks

Packages

Contributors

Languages

  • Swift 99.6%
  • Other 0.4%