KeyboardKit

8.7.0

KeyboardKit is a Swift SDK that lets you create fully customizable keyboards with a few lines of code, using SwiftUI.
KeyboardKit/KeyboardKit

What's New

2024-06-19T18:59:27Z

This version improves the overall autocomplete behavior.

The local autocomplete service will now return proper unknown statuses and suggest any lexicon matches as autocorrections. The standard action handler will automatically ask the autocomplete provider to learn any applied unknown suggestions, if isAutoLearnEnabled is true.

This way to learn unknown suggestions will hopefully solve many frustrations involved with autocomplete, where the provider will behave better over time. Please provide feedback if these adjustments don't behave as expected.

The local autocomplete service can also perform next character prediction, by providing it with the typed text and a list of suggestions. This will be merged with the autocomplete operation in version 9.0.

The autocomplete context also has new ways of registering your own custom autocorrections for any locale, in case you find the default behavior to be lacking in some areas.

Furthermore, this version adds new persistent settings types, adds a KeyboardLocaleInfo protocol to make KeyboardLocale and Locale share many properties, and makes it possible to define which text to use when ending the current sentence.

๐Ÿšจ Important Information

  • AutocompleteService and all implementations have been renamed to use the new Service name.
  • Autocomplete.LocalService no longer caps suggestions by default. That responsibility is moved to the context.
  • Autocomplete.ToolbarItem no longer adds quotations around unknown suggestions. That responsibility is moved to AutocompleteService.
  • KeyboardInputViewController now checks more things before performing autocomplete, for instance the keyboard context prefersAutocomplete.
  • KeyboardStyleProvider and Keyboard.ButtonStyle now supports native Fonts. This may cause some breaking changes that should be easy to fix.

๐Ÿ†• New Settings Types

  • AutocompleteSettings is a new observable settings type.
  • DictationSettings is a new observable settings type.
  • FeedbackSettings is a new observable settings type.
  • Keyboard.Settings is a new settings wrapper.

โœจ Features

  • Autocomplete.Suggestion has new functions.
  • Autocomplete.TextReplacementDictionary is new type.
  • AutocompleteContext has a new autocorrectDictionary value.
  • AutocompleteContext has a new isAutoLearnEnabled property.
  • AutocompleteContext has a new suggestionDisplayCount property.
  • AutocompleteContext has a new suggestionsFromService property.
  • AutocompleteService has a new nextCharacterPredictions function.
  • AutocompleteService has new ignoreWords(_:) and suggestion functions.
  • KeyboardBehavior and its implementations have a new endSentenceText property.
  • KeyboardAction.StandardProvider can now automatically learn unknown suggestions.
  • KeyboardContext has a new syncKeyboardType(with:) to sync type with the proxy.
  • KeyboardController has a new endSentence(withText:) function to end sentences.
  • KeyboardInputViewController has a new settings property for setting instances.
  • KeyboardInputViewController has a new viewWillSetupInitialKeyboardType method.
  • KeyboardLocaleInfo is a new protocol that is shared by KeyboardLocale and Locale.
  • KeyboardSettings has new ways to register a custom store and settings key prefix.
  • KeyboardStyleProvioder has new ways to register a custom store and settings key prefix.
  • UserDefaults has a new .keyboardSettings value that can be used to persist data.

๐Ÿ’ก Adjustments

  • Autocomplete.Toolbar no longer needs an injected locale.
  • Autocomplete.ToolbarItem no longer needs an injected locale.
  • Autocomplete.ToolbarItem no longer adds quotations to unknown suggestions.
  • KeyboardContex prefersAutocomplete is now computed and no longer synced.
  • KeyboardInputViewController now checks KeyboardContext.prefersAutocomplete.
  • KeyboardLayout.iPhoneProvider now handles more keyboard types in a better way.
  • KeyboardSettings have been converted from a namespace to being a part of Keyboard.
  • KeyboardStyle.StandardProvider now sets a smaller font size for the .text action type.

๐Ÿ‘‘ KeyboardKit Pro

  • Autocomplete.LocalService no longer takes a maxCount parameter.
  • Autocomplete.LocalService will now return lexicon matches as autocorrections.
  • Autocomplete.LocalService will now return proper unknown state for suggestions.
  • Dictation.ProKeyboardService uses an action handler to open app and navigate back.
  • Emoji.KeyboardMenu will now trigger haptic feedback when tapping an emoji category.
  • KeyboardHostApplication now implements Identifiable and has a new name property.
  • KeyboardHostApplication now defines even more applications and has a url property.
  • KeyboardHostApplicationProvider is a new protocol that is implemented by some types.

๐Ÿ› Bug fixes

  • KeyboardAction.text now properly renders its texts.
  • KeyboardInputViewController now sets the initial keyboard type when the native type is ready.
  • KeyboardLayout.iPhoneProvider no longer inserts two . keys for email keyboards with a go key.
  • UITextDocumentProxy now proceeds inserting a word replacement even if there's no current word.

๐Ÿ—‘๏ธ Deprecations

  • Keyboard.ReturnKeyType prefersAutocomplete has been deprecated, since the keyboard type should determine this.

KeyboardKit Logo

Version Swift 5.9 Swift UI MIT License Twitter: @@getkeyboardkit Mastodon: @keyboardkit@techhub.social

About KeyboardKit

KeyboardKit is a Swift SDK that lets you create fully customizable keyboards in a few lines of code, using SwiftUI.

KeyboardKit extends Apple's native APIs and provides you with a lot more functionality. It lets you mimic the native iOS keyboard and tweak its style and behavior, or create completely custom keyboards.

Custom iOS keyboard extensions can be used with all other apps that support text input. It's the only way for your product, brand or technology to directly interact with other apps on iOS. Don't miss out!

KeyboardKit can be used in different ways. Keyboard extensions can use it to create custom keyboards. Apps can use it to check keyboard and full access status, provide settings etc.

Installation

KeyboardKit can be installed with the Swift Package Manager:

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

After installing KeyboardKit, make sure to link it to all targets that need it.

Getting Started

After installing KeyboardKit, just make your KeyboardViewController inherit KeyboardInputViewController instead of UIInputViewController:

import KeyboardKit

class KeyboardController: KeyboardInputViewController {}

This gives your controller access to new lifecycle functions like viewWillSetupKeyboard, observable state like state.keyboardContext, services like services.actionHandler, and much more.

If you just want to use the default SystemKeyboard view, which mimics a native iOS keyboard, you don't have to do anything else. KeyboardKit will set up everything.

To replace or customize the default SystemKeyboard, just override viewWillSetupKeyboard and call setup with a view builder:

class KeyboardViewController: KeyboardInputViewControllerย {

    override func viewWillSetupKeyboard() {
        super.viewWillSetupKeyboard()
        setup { [weak self] controller in // <-- Use [weak self] or [unowned self] if you need self here.
            SystemKeyboard(
                state: controller.state,
                services: controller.services,
                buttonContent: { $0.view },
                buttonView: { $0.view },
                emojiKeyboard: { $0.view },
                toolbar: { _ in MyCustomToolbar() }
            )
        }
    }
}

For more information, please see the getting started guide.

Supported Locales

KeyboardKit supports 68 keyboard-specific locales:

๐Ÿ‡ฆ๐Ÿ‡ฑ ๐Ÿ‡ฆ๐Ÿ‡ช ๐Ÿ‡ฆ๐Ÿ‡ฒ ๐Ÿ‡ง๐Ÿ‡พ ๐Ÿ‡ง๐Ÿ‡ฌ ๐Ÿ‡ฆ๐Ÿ‡ฉ ๐Ÿณ๏ธ ๐Ÿ‡ญ๐Ÿ‡ท ๐Ÿ‡จ๐Ÿ‡ฟ ๐Ÿ‡ฉ๐Ÿ‡ฐ
๐Ÿ‡ณ๐Ÿ‡ฑ ๐Ÿ‡ง๐Ÿ‡ช ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ช๐Ÿ‡ช ๐Ÿ‡ซ๐Ÿ‡ด ๐Ÿ‡ต๐Ÿ‡ญ ๐Ÿ‡ซ๐Ÿ‡ฎ ๐Ÿ‡ซ๐Ÿ‡ท
๐Ÿ‡จ๐Ÿ‡ฆ ๐Ÿ‡ง๐Ÿ‡ช ๐Ÿ‡จ๐Ÿ‡ญ ๐Ÿ‡ฌ๐Ÿ‡ช ๐Ÿ‡ฉ๐Ÿ‡ช ๐Ÿ‡ฆ๐Ÿ‡น ๐Ÿ‡จ๐Ÿ‡ญ ๐Ÿ‡ฌ๐Ÿ‡ท ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ฎ๐Ÿ‡ฑ
๐Ÿ‡ญ๐Ÿ‡บ ๐Ÿ‡ฎ๐Ÿ‡ธ ๐Ÿณ๏ธ ๐Ÿ‡ฎ๐Ÿ‡ฉ ๐Ÿ‡ฎ๐Ÿ‡ช ๐Ÿ‡ฎ๐Ÿ‡น ๐Ÿ‡ฐ๐Ÿ‡ฟ ๐Ÿ‡น๐Ÿ‡ฏ ๐Ÿ‡น๐Ÿ‡ฏ ๐Ÿ‡น๐Ÿ‡ฏ
๐Ÿ‡ฑ๐Ÿ‡ป ๐Ÿ‡ฑ๐Ÿ‡น ๐Ÿ‡ฒ๐Ÿ‡ฐ ๐Ÿ‡ฒ๐Ÿ‡พ ๐Ÿ‡ฒ๐Ÿ‡น ๐Ÿ‡ฒ๐Ÿ‡ณ ๐Ÿณ๏ธ ๐Ÿ‡ณ๐Ÿ‡ด ๐Ÿ‡ณ๐Ÿ‡ด ๐Ÿ‡ฎ๐Ÿ‡ท
๐Ÿ‡ต๐Ÿ‡ฑ ๐Ÿ‡ต๐Ÿ‡น ๐Ÿ‡ง๐Ÿ‡ท ๐Ÿ‡ท๐Ÿ‡ด ๐Ÿ‡ท๐Ÿ‡บ ๐Ÿ‡ท๐Ÿ‡ธ ๐Ÿ‡ท๐Ÿ‡ธ ๐Ÿ‡ธ๐Ÿ‡ฐ ๐Ÿ‡ธ๐Ÿ‡ฎ ๐Ÿ‡ช๐Ÿ‡ธ
๐Ÿ‡ฆ๐Ÿ‡ท ๐Ÿ‡ฒ๐Ÿ‡ฝ ๐Ÿ‡ฐ๐Ÿ‡ช ๐Ÿ‡ธ๐Ÿ‡ช ๐Ÿ‡น๐Ÿ‡ท ๐Ÿ‡บ๐Ÿ‡ฆ ๐Ÿ‡บ๐Ÿ‡ฟ ๐Ÿด๓ ง๓ ข๓ ท๓ ฌ๓ ณ๓ ฟ

KeyboardKit provides a basic keyboard layout with basic callout actions.ย KeyboardKit Pro provides localized layouts, callouts and behaviors for all supported locales.

Open-Source Features

KeyboardKit comes packed features to help you build amazing keyboard extensions:

  • โŒจ๏ธ Essentials - KeyboardKit provides essential utilities, types & views.
  • ๐Ÿ’ฅ Actions - KeyboardKit makes it easy to trigger keyboard-related actions.
  • ๐Ÿค– AI - KeyboardKit has features that are needed for AI.
  • ๐Ÿ“ฑ App - KeyboardKit has app-specific screens & views.
  • ๐Ÿ’ก Autocomplete - KeyboardKit can perform autocomplete.
  • ๐Ÿ—ฏ Callouts - KeyboardKit can show input & secondary action callouts.
  • ๐ŸŒˆ Colors - KeyboardKit defines keyboard-specific colors.
  • ๐Ÿ–ฅ๏ธ Device - KeyboardKit has device-specific utilities.
  • ๐ŸŽค Dictation - KeyboardKit can perform dictation from the keyboard.
  • ๐Ÿ˜€ Emojis - KeyboardKit defines emojis, categories, versions, skin tones, etc.
  • ๐Ÿ”‰ Feedback - KeyboardKit can trigger audio & haptic feedback.
  • ๐Ÿ‘† Gestures - KeyboardKit has a customizable keyboard gesture engine.
  • ๐Ÿ  Host - KeyboardKit can identify the host application.
  • ๐Ÿ–ผ๏ธ Images - KeyboardKit defines keyboard-specific images.
  • ๐Ÿ”ฃ Layout - KeyboardKit has customizable input sets & keyboard layouts.
  • ๐ŸŒ Localization - KeyboardKit supports 68 locales.
  • ๐Ÿ—บ๏ธ Navigation - KeyboardKit lets you open urls and apps from the keyboard.
  • ๐Ÿ‘ Previews - KeyboardKit has extension keyboard preview support.
  • โžก๏ธ Proxy - KeyboardKit extends the text document proxy with a lot more capabilities.
  • โš™๏ธ Settings - KeyboardKit has tools for in-app settings & System Settings.
  • ๐Ÿฉบ Status - KeyboardKit can detect if a keyboard is enabled, has full access, etc.
  • ๐ŸŽจ Styling - KeyboardKit lets you style your keyboards to great extent.
  • ๐Ÿ“ Text - KeyboardKit can route text to input fields within the keyboard.
  • ๐Ÿญ Themes - KeyboardKit can use themes to style keyboards in flexible ways.

Many features are open-source and free to use. You can upgrade to KeyboardKit Pro to unlock Pro features.

Documentation

The online documentation has more information, articles, code examples, etc.

Demo App

The demo app shows how to display keyboard state, link to system settings, etc.

The demo app has two demo keyboards:

  • Keyboard uses KeyboardKit and a customized SystemKeyboard.
  • KeyboardPro uses KeyboardKit Pro and enables all locales, autocomplete, themes, etc.

Just open and run the demo app in the Demo folder, then enable the keyboards under System Settings. Note that you need to enable full access for some features to work.

KeyboardKit App

If you want to try KeyboardKit Pro without having to write any code or build the demo app from Xcode, there is a KeyboardKit app in the App Store, that lets you try out many pro features.

Support This Project

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

License

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

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

Last updated: Fri Jul 26 2024 10:17:04 GMT-0900 (Hawaii-Aleutian Daylight Time)