Swiftpack.co - KeyboardKit/KeyboardKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
KeyboardKit is a Swift library that helps you create custom keyboard extensions for iOS and ipadOS.
.package(url: "https://github.com/KeyboardKit/KeyboardKit.git", from: "5.0.0")


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 using SwiftUI.

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

KeyboardKit lets you create rich system keyboards with support for multiple locales, gestures, callouts etc.

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.


Swift Package Manager



target 'MyApp' do
  pod 'KeyboardKit'

target 'MyKeyboard' do
  pod 'KeyboardKit'

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'

Getting Started

To build a keyboard extension with KeyboardKit, first add KeyboardKit to your app's keyboard extension as shown above. You can add it to the main app target as well, if you want to use it there.

Then, inherit KeyboardInputViewController instead of UIInputViewController. It provides you with a lot of additional functionality, e.g. new lifecycle functions, observables like keyboardContext and services like keyboardActionHandler, keyboardAppearance, autocomplete logic etc.

KeyboardInputViewController will call viewWillSetupKeyboard whenever the keyboard must be created or re-created. You can use setup(with:) in that function, to setup your extension with any SwiftUI view.

Setting up the view controller with a SwiftUI view will make the view the main view of the extension, inject necessary environment objects and resize the keyboard extension to fit the view.

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

๐Ÿ‡ธ๐Ÿ‡ช Localization

KeyboardKit is localized in the following languages:

  • ๐Ÿ‡บ๐Ÿ‡ธ English (US - Default)

  • ๐Ÿ‡ฉ๐Ÿ‡ฐ Danish

  • ๐Ÿ‡ณ๐Ÿ‡ฑ Dutch

  • ๐Ÿ‡ฌ๐Ÿ‡ง English (UK)

  • ๐Ÿ‡ซ๐Ÿ‡ฎ Finnish

  • ๐Ÿ‡ซ๐Ÿ‡ท French

  • ๐Ÿ‡ฉ๐Ÿ‡ช German

  • ๐Ÿ‡ฎ๐Ÿ‡น Italian

  • ๐Ÿ‡ณ๐Ÿ‡ด Norwegian

  • ๐Ÿ‡ช๐Ÿ‡ธ Spanish

  • ๐Ÿ‡ธ๐Ÿ‡ช Swedish

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

Read more here


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


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 and an autocomplete engine. Going pro is also a way to support this project.

Go Pro here!


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 KeyboardKit by sponsoring the project on GitHub Sponsors, signing up for a KeyboardKit Pro license or hiring me for consultation.


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


Stars: 585
Last commit: 2 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jackโ€™d and SCRUFF. We are two of the worldโ€™s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

4 days ago

KeyboardKit 5.0 streamlines the library, improves styling and previewing and makes the library easier to use.

This version also removes all UIKit-specific functionality as well as all previously deprecated functionality.

This version also adjust keyboard button sizes to be more correct on more device types, e.g. iPhone Pro Max, iPad Pro etc.

KeyboardKit 5.0 requires Xcode 13 and Swift 5.5.

โœจ New features

  • Library types now implement protocols like Codable and Identifiable to greater extent.

  • Library views have a lot more previews than before, which make them much easier to adjust.

  • Library views no longer depend on environment objects, which make them easier to create and use.

  • AudioFeedbackConfiguration has a new action-specific feedback list.

  • AudioFeedbackConfiguration has a new, static enabled configuration.

  • AutocompleteContext has a new isLoading property.

  • AutocompleteToolbarItemSubtitle is a new view that renders autocomplete subtitles.

  • Collection+RowItem has new extensions to affect all rows.

  • EdgeInsets has a new init(all:) initializer.

  • EdgeInsets has a new init(horizontal:,vertical:) initializer.

  • EmojiCategory has a new emojisString property.

  • EmojiKeyboardStyle has new systemFont and selectedCategoryColor properties.

  • HapticFeedbackConfiguration has a new action-specific feedback list.

  • HapticFeedbackConfiguration has a new, static enabled configuration.

  • InputCalloutContext has a new, static .disabled context.

  • KeyboardAction has a new inputCalloutText property.

  • KeyboardAction has a new isCharacterAction property.

  • KeyboardAppearance has a new inputCalloutStyle() function.

  • KeyboardAppearance has a new secondaryInputCalloutStyle() function.

  • KeyboardContext has a new screen property.

  • KeyboardInputTextComponent is now public.

  • KeyboardLayoutConfiguration is a new type that replaces the CGFloat and UIEdgeInsets extensions.

  • KeyboardLayoutConfiguration has a bunch of standard layout configs for different devices.

  • NextKeyboardButton is now SwiftUI-based and don't require any special setup.

  • Preview services have new, static .preview protocol properties.

  • SecondaryInputCalloutContext has a new, static .disabled context.

  • StandardHapticFeedbackPlayer has a new shared player.

  • StandardKeyboardFeedbackHandler now prefers action-specific feedback, if defined.

  • StandardSystemAudioPlayer has a new shared player.

  • SystemKeyboardActionButton is a new view that makes it easy to create action-based keyboard buttons.

  • SystemKeyboardButton is a new view that makes it easy to create standalone keyboard buttons.

  • SystemKeyboardButtonText is a new view that just sets up text correctly.

  • SystemKeyboardSpaceButton can now wrap any content.

  • View+Callout has a new calloutShadow extension.

๐ŸŽจ Styling

  • AutocompleteToolbarStyle is a new style that can style autocomplete toolbars.
  • AutocompleteToolbarItemStyle is a new style that can style autocomplete toolbar items.
  • AutocompleteToolbarItemBackgroundStyle is a new style that can style the autocomplete highlight.
  • AutocompleteToolbarSeparatorStyle is a new style that can style autocomplete toolbar separators.
  • CalloutStyle has a new, static .standard style.
  • InputCalloutStyle has a new, static .standard style.
  • SecondaryInputCalloutStyle has a new, static .standard style.
  • SystemKeyboardButtonBorderStyle has a new, static .standard style.
  • SystemKeyboardButtonShadowStyle has a new, static .standard style.
  • SystemKeyboardButtonShadowStyle has new, default init parameter values.

๐Ÿ’ก Behavior changes

  • AutocompleteToolbar now applies the autocomplete background instead of the item view.
  • AutocompleteToolbarItem's standard item builder now renders a subtitle if the suggestion has one.
  • InputCallout and SecondaryInputCallout look more like the native callouts.
  • KeyboardAction+Button now returns KKL10n.space for .space action.
  • KeyboardGestures now resolves input contexts from the shared controller, instead of using environment objects.
  • StandardKeyboardAppearance uses a small transparency to make standard buttons bleed through the underlying vibrancy.
  • SystemKeyboard uses the new callout styles in the appearance.
  • SystemKeyboardActionButtonContent now returns a SystemKeyboardSpaceButtonContent for .space.
  • SystemKeyboardButtonContent now uses appearance for both text and image logic.
  • SystemKeyboardButtonContent no longer applies RTL transforms on the image, since SF symbols do this automatically.
  • SystemKeyboardButtonStyle now applies a standard shadow style by default.
  • SystemKeyboardSpaceButtonContent no longer auto-resolves texts, but instead show just what you provide it with.
  • SystemKeyboardSpaceButton now takes up as much horizontal space as it can.

๐Ÿ› Bug fixes

  • InputCallout and SecondaryInputCallout no longer get tear lines in some apps.
  • SystemKeyboardActionButton now handles the .nextKeyboard action correctly.

๐Ÿ’ฅ Breaking changes

  • All deprecated functionality has been removed.

  • All UIKit-specific functionality has been removed.

  • Library views that no longer depend on environment objects, may require more init parameters.

  • Initializer argument changes are omitted in the list below.

  • AutocompleteProvider ignoredWords is now read-only.

  • AutocompleteResponse has been renamed to AutocompleteCompletion.

  • AutocompleteToolbarItemText has been renamed to AutocompleteToolbarItemTitle.

  • AudioFeedback has been renamed to SystemAudio.

  • BaseSecondaryCalloutActionProvider's init is now throwing.

  • CalloutStyle buttonOverlayInset has been renamed to buttonInset.

  • CGFloat+Keyboard has been replaced with KeyboardLayoutConfiguration.

  • Color clearInteractable has been made as internal and will be removed over time.

  • EdgeInsets+Keyboard has been replaced with KeyboardLayoutConfiguration.

  • EmojiKeyboard button builder no longer takes a context.

  • EmojiKeyboardConfiguration has been renamed to EmojiKeyboardStyle

  • HapticFeedback prepare and trigger now only has a non-static version.

  • HapticFeedback.player has been removed.

  • InputCalloutContext buttonFrame(for:) has been removed.

  • InputCalloutContext updateInput(for:geo:) has been renamed to updateInput(for:,in:).

  • KeyboardAction+Button styles have been moved into StandardKeyboardAppearance.

  • KeyboardBehavior has a new shouldSwitchToCapsLock function.

  • KeyboardCasing.neutral has been removed.

  • KeyboardEnabledStateInspector isKeyboardEnabled for parameters has been renamed to withBundleId.

  • KeyboardInputSetProvider functions have been converted to properties.

  • KeyboardType.custom has been renamed to KeyboardType.custom(named:).

  • SecondaryInputCalloutContext alignment is now a HorizontalAlignment.

  • SecondaryInputCalloutContext buttonFrame(for:) has been removed.

  • SecondaryInputCalloutContext updateInputs(for:geo:alignment) has been renamed to updateInputs(for:in:alignment:).

  • SecondaryInputCalloutStyle selectedTextColor has been renamed to selectedForegroundColor.

  • SecondaryInputCalloutStyle verticalPadding has been renamed to verticalTextPadding.

  • Sequence batched(withBatchSize:) has been renamed to batched(into:).

  • SpaceDragSensitivity.custom has been renamed to custom(points:).

  • SystemAudio systemId has been renamed to id.

  • SystemAudio trigger has been renamed to play.

  • SystemAudio play now only has a non-static version.

  • SystemAudio.player is now SystemAudioPlayer.shared.

  • SystemAudioPlayer now takes SystemAudio as argument.

  • SystemKeyboardButton has been renamed to SystemKeyboardActionButton.

  • SystemKeyboardButtonContent has been renamed to SystemKeyboardActionButtonContent.

  • SystemKeyboardButtonRowItem now requires an injected context.

  • SystemKeyboardLayoutProvider hasElevenElevenSevenAlphabeticInput is now computed instead of lazy.

  • Toast has been removed.

  • UITextDocumentProxy deleteBackward with range has been renamed to deleteBackward(range:)

  • View+DynamicType has been removed.

  • View+Autocomplete has been removed.

  • View+Callout is now internal.

  • View+DynamicType has been removed.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics