KeyboardKit
KeyboardKit is a Swift library that helps you create custom keyboard extensions for iOS and ipadOS. It provides you with a rich set of keyboard-specific tools and actions, supports haptic and audio feedback and lets you create keyboards with characters, emojis, images, custom actions etc.
Installation
Swift Package Manager
https://github.com/danielsaidi/KeyboardKit.git
CocoaPods
target 'MyApp' do
pod 'KeyboardKit'
end
target 'MyKeyboard' do
pod 'KeyboardKit'
end
Getting Started
After adding KeyboardKit
to your project, make your extension inherit KeyboardInputViewController
instead of UIInputViewController
. It provides you with many tools that helps you build custom keyboard extension.
KeyboardKit supports both UIKit
and SwiftUI
, so you can pick the option that suits your needs best. SwiftUI
support is currently kept in a separate library, but will be the main focus going forward.
SwiftUI
Since version 2.7.0
, KeyboardKit provides new tools that help you build SwiftUI-based keyboards. SwiftUI will be the main focus going forward, with the aim to improve SwiftUI support in version 3.x
and move it to the main repo in 4.0
. When this happens, KeyboardKit will target iOS 13 and up.
Due to a Swift toolchain bug, SwiftUI support must be kept in a separate library. Until the bug is fixed, you must add both KeyboardKit
and KeyboardKitSwiftUI
to your project, if you want to use KeyboardKit
with SwiftUI.
Actions
KeyboardKit supports many different keyboard actions, like character
inputs, emoji
inputs, backspace
, newline
, space
, image
etc. You can even create your own, custom actions.
Keyboard Types
KeyboardKit supports many different keyboard types, like alphabetic
, numeric
, symbolic
, emoji
etc. You can even create your own, custom keyboard types.
Autocomplete
KeyboardKit supports autocomplete and can present autocomplete suggestions to users as they type.
Haptic Feedback
KeyboardKit supports haptic feedback and can give users haptic feedback as they type.
Audio Feedback
KeyboardKit supports audio feedback and can give users audio feedback as they type.
Extensions
KeyboardKit comes with many keyboard-specific extensions. Check out the demo apps and source code for examples and more information.
Views and components
KeyboardKit comes with many views and components that can be composed into custom UIKit and SwiftUI-based keyboards, e.g. button
, rows
, toolbars
etc.
Demo Application
This repository contains two demo apps that demonstrate different keyboard types, like alphabetical
(lower/uppercased and caps locked), numerical
, symbols
, emojis
and images
.
KeyboardKitDemoKeyboard
uses UIKit
while KeyboardKitDemoKeyboard_SwiftUI
uses SwiftUI
.
Note that audio feedback, haptic feedback and image actions require full access. Also, the image
switcher is only shown on notch devices.
To run the demo app, open and run the KeyboardKit.xcodeproj
project then enable the keyboards under system settings. Don't forget to enable full access.