Swiftpack.co - Package - KeyboardKit/KeyboardKit

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

KeyboardKit/KeyboardKit

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

KeyboardKit

Version Platform Swift 5.3 MIT License Twitter: @danielsaidi

About KeyboardKit

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

KeyboardKit provides you with actions, input sets and layouts, appearances and autocomplete support, haptic and audio feedback etc. It lets you create keyboards with characters, numbers, symbols, emojis, images and more or just use the additional tools and extensions that it provides.

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

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

Swift Package Manager

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

CocoaPods

target 'MyApp' do
  pod 'KeyboardKit'
end

target 'MyKeyboard' do
  pod 'KeyboardKit'
end

post_install do |installer|
   installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
          config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
      end
   end
end

Getting Started

To build a keyboard extension with KeyboardKit, add KeyboardKit to your project as shown above.

If you use Swift Package Manager, make sure to add KeyboardKit to your keyboard extension. You can add it to your hosting app as well, but the keyboard extension must have it.

You can then import KeyboardKit and let your KeyboardController inherit KeyboardInputViewController instead of UIInputViewController. It's a KeyboardKit-specific controller that provides you with a lot of additional functionality that extends the native keyboard framework. Your controller will get a bunch of extra properties, like keyboardContext, keyboardActionHandler, keyboardAppearance etc. and the extension will get access to autocomplete logic, extensions and much, much more.

KeyboardInputViewController has a setup(with:) function that can be used to setup your extension with any SwiftUI view. This will make the view the main view of the extension, inject necessary environment objects and finally resize the keyboard extension to fit the view.

To learn more about and see KeyboardKit in practice, continue reading about the various parts of the library below and have a look at the demo app to see how it sets up a custom keyboardView and adjusts it depending on the keyboard type, locale etc.

Go Pro!

KeyboardKit Pro is a license-based extensions that unlocks pro features, such as additional locales. Going pro is also a way to support this project. Read more here.

You can try KeyboardKit Pro in the demo app, by activating the commented out setupPro line in the demo app's KeyboardViewController.

SwiftUI vs. UIKit

KeyboardKit supports both SwiftUI and UIKit, but SwiftUI is the main focus going forward. You can read more about UIKit support here. The rest of this readme assumes that you're using SwiftUI, although most information is valid for both UIKit and SwiftUI.

Features

πŸ’₯ Keyboard 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

😊 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

πŸ”€ Input Sets

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

πŸ‡ΈπŸ‡ͺ Localization

KeyboardKit comes with built-in support for English keyboards and can be easily extended to support more locales.

KeyboardKit also has a KKL10n enum that provides localized texts.

Read more here

🎨 Appearances

KeyboardKit lets you create everything from completely custom keyboards to keyboards that imitate the native keyboards and can be styled with custom appearances.

Read more here

πŸ—― Callouts

KeyboardKit lets you show callout bubbles as the users type, as well as secondary action callouts that can provide users with optional actions when long pressing a keyboard button.

Read more here

πŸ’‘Autocomplete

KeyboardKit can present autocomplete suggestions to users as they type. The core library doesn't come with an implemented engine, but you can inject your own.

Read more here

βœ‹ Haptic Feedback

KeyboardKit keyboards can give users haptic feedback as they type.

Read more here.

πŸ”ˆ Audio Feedback

KeyboardKit keyboards can give users audio feedback as they type.

Read more here.

πŸ“¦ Extensions

KeyboardKit comes with many keyboard-specific extensions, like providing the text document proxy with powerful, otherwise missing functionalty etc. Check out the demo apps and source code for examples and more information.

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 or provide pixel perfection, but rather to give you inspiration to how you can build your own keyboards.

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.

Contact

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 individuals and companies:

Oribi Logo Anomaly Software Logo Milo Creative Logo

You can support my work by sponsoring the project on GitHub Sponsors or hiring me for consultation. I'd be happy to help you out in any way that I can.

License

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

Github

link
Stars: 432
Last commit: 1 week ago

Releases

- 2021-02-25T14:18:26

This patch fixes a few minor things:

  • ✨ LocaleKey now implements CaseIterable.
  • πŸš‘ StandardKeyboardActionHandler had a memory leak that has been fixed.