KeyboardKit is a Swift SDK that lets you create fully customizable keyboards with a few lines of code, using SwiftUI.
MIT License
Bot releases are visible (Hide)
This release fixes issues with EmojiKeyboard
and EmojiCategoryKeyboard
.
The internal EmojiKeyboardItem
that created unique IDs caused the emojis to constantly re-render. It has been removed.
Note that this change now requires emojis to be unique within a certain keyboard.
More styles now have var properties instead of lets, which means that it's easy to create and change a mutable copy of a style.
AutocompleteToolbarStyle
are now vars instead of lets.AutocompleteToolbarItemStyle
are now vars instead of lets.AutocompleteToolbarItemBackgroundStyle
are now vars instead of lets.AutocompleteToolbarSeparatorStyle
are now vars instead of lets.EmojiKeyboardStyle
are now vars instead of lets.EmojiKeyboardStyle
now has new abcText
and backspaceIcon
which will be used to make category views no longer require appearance.EmojiCategoryKeyboard
now resets scroll offset when changing category.EmojiCategoryKeyboard
now persists category changes right away instead of when disappearing.EmojiKeyboard
no longer generates unique IDs for each emoji, which improves performance.EmojiKeyboardStyle
now uses the primary color instead of black to make highlighting show in dark mode.Thanks to @digitalheir, this release removes the need for using AnyView
in many places.
Thanks to @danielpunkass, this release makes it possible to use the library within an app target.
This version also adds missing emojis.
Bundle
has new isExtension
extension property.Locale
has new localizedName
extension property.StandardSystemKeyboardButtonView
is a new typealias that defines the standard system keyboard button view.StandardSystemKeyboardButtonContent
is a new typealias that defines the standard system keyboard button content.SystemKeyboard
has a new, static standardKeyboardWidth
.View
has new, generic localeContextMenu
extensions that can be used to create custom locale context menus.AutocompleteToolbar
is now generic.EmojiKeyboard
is now generic.SystemKeyboard
is now generic.SystemKeyboardSpaceButtonContent
is now generic.KeyboardActionRow
is the same thing as KeyboardActions
and wasn't used in the library.KeyboardLayout
items
initializer has been replaced with an itemRows
initializer.KeyboardLayout
item
has been replaced with itemRows
.AnyView
-based SystemKeyboard
initializers and builders have been replaced with the new, generic initializers.AnyView
-based SystemKeyboard
initializers and builders have been replaced with the new, generic initializers.Although we aimed to implement the new generic views with no breaking changes, there may be some that slipped us by.
CGSize
device dimension properties are now public:
KeyboardFeedbackSettings
has new properties and functions:
KeyboardTextField
has a new placeholder
property.String
has new vowels
and isVowel
extension properties.AudioFeedbackToggleButton
is a new view that can be used to toggle audio feedback on and off.EnabledLabel
is a new view that can be used to show different views depending on a provided enabled state.HapticFeedbackToggleButton
is a new view that can be used to toggle haptic feedback on and off.KeyboardActiveLabel
is a new view that can be used to present whether or not a keyboard extension is currently being used to edit a text field.KeyboardEnabledLabel
is a new view that can be used to present whether or not a keyboard extension is enabled in System Settings.License
now implements Codable
and has a public initializer, as well as new tier
and additionalInfo
properties.LicenseCustomer
now implements Codable
and has a public initializer, as well as a new additionalInfo
property.LicenseTier
is a new type that defines the level of service for your specific license.ToggleToolbar
is a new view that can be used to toggle between two toolbars.EmojiCategory.frequent
now uses the frequent provider to resolve its emojis.EmojiCategoryKeyboardMenu
now shows the "frequent" category once more.EmojiCategoryKeyboardMenu
has reduced circle padding to avoid clipping on smaller screens.KeyboardKitLicense
has been renamed to License
.KeyboardKitLicense+Customer
has been converted to a typealias for LicenseCustomer
and has been deprecated.This version adds support for Russian
and Ukrainian
and bumps the package's Swift version to 5.5 to enable DocC support.
By adding DocC support, the documentation has been updated to allow for topics, cross-linking etc. You can download the documentation from the project website or find a zipped version in the Docs
folder.
This version adds support for estonian
, latvian
and lithuanian
.
This version also adds new inspection capabilities and fixes some bugs.
UITextDocumentProxy
has a new hasCurrentWord
property.InputCallout
has a new calloutPadding
property.KeyboardEnabledState
has a new isKeyboardCurrentlyActive
property.KeyboardEnabledStateInspector
has a new isFullAccessEnabled
property.KeyboardEnabledStateInspector
has a new isKeyboardCurrentlyActive
function.InputCallout
now calculates a minimum callout width based on button size, curve size etc.InputCallout
now applies a minimum callout size instead of a fixed one, which means that the callout content can be larger.InputCallout
was rendered too wide by default, when used in SystemKeyboard
. This has been fixed.SecondaryInputCallout
applied an incorrect leading corner radius. This has been fixed.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.
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.
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.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.InputCallout
and SecondaryInputCallout
no longer get tear lines in some apps.SystemKeyboardActionButton
now handles the .nextKeyboard
action correctly.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.
This version fixes the iOS 15 autorotate bug and adds a property that can suppress the needsInputModeSwitchKey
warning.
KeyboardInputViewController
has a new viewWillSetupKeyboard
function that can be overridden to setup the keyboard at the proper time. It's just a convenience function. You can still setup the keyboard whenever you want.KeyboardInputViewController
has a new, static needsInputModeSwitchKeyOverride
that can be set to make all input controllers ignore the real value. This can be useful when you want to create a keyboard preview and don't want all the warnings.KeyboardInputViewController
has a new needsInputModeSwitchKeyOverride
that can be set to make an input controllers ignore the real value. It will default to the static property value.KeyboardInputViewController
setup(with:)
stack view variant is deprecated and will be removed in 5.0.This version adds styles, which makes it a lot easier to style system keyboards.
It also exposes more system keyboard views and styles publicly.
Starting with this version, the library will start deprecating stuff that willbe changed in KK 5. The aim is to release several patches to prepare the library for the changes to come through deprecations instead of breaking changes.
KeyboardAppearance
has a new systemKeyboardButtonStyle
function.NextKeyboardButton
has an iOS 14 exclusive Color
-based initializer that is now used by SystemKeyboardButtonContent
SystemKeyboardButtonBody
is a new view that represents the body of a system keyboard button.SystemKeyboardButtonShadow
is a new view that represents the shadow of a system keyboard button.SystemKeyboardButtonStyle
is a new style that can be used to define a system keyboard button style.SystemKeyboardButtonBorderStyle
is a new style that can be used to define a system keyboard button border.SystemKeyboardButtonShadowStyle
is a new style that can be used to define a system keyboard button shadow.TextInputProxy
now implements UITextInputTraits
as well.View+systemKeyboardButtonStyle
view extension now taes a style instead of an apperance, action and isPressed bool.EmojisCategoryKeyboardMenu
now uses fixed fonts.SystemKeyboardButtonContent
now applies the appearance text color to the "next keyboard" button (on iOS 14+).AutocompleteSuggestionProvider
has been renamed to AutocompleteProvider
.KeyboardAppearance
has deprecated all functions that now can be fetched from the new systemKeyboardButtonStyle
style.KeyboardInputViewController
autocompleteSuggestionProvider
has been renamed to autocompleteProvider
.View+keyboardButtonStyle
has been replaced with View+systemKeyboardButtonStyle
.AutocompleteSuggestionProvider
autocompleteSuggestions
is now escaping.This versions adds new colors, such as the new standard keyboard background colors, which you can use to mimic keyboard backgrounds.
There are other new colors as well, that are used to work around the iOS color scheme bug, described here and in the docs.
This makes it possible for us to finally workaround the dark mode color bug, and let the system keyboard look as the system keyboard in both dark mode and dark appearance keyboards.
Finally, the dark appearance colors have been renamed and their old names deprecated.
KeyboardLocale
is now Codable
.KeyboardColor
has new colors.Color+Keyboard
has new colors..standardButtonBackgroundForColorSchemeBug
is a new color scheme bug color..standardDarkButtonBackgroundForColorSchemeBug
is a new color scheme bug color.CalloutStyle.standard
now uses the look of systemStyle
, since that IS the standard. The system styles have been deprecated.SystemKeyboard
uses the new standard callout styles.InputCallout
now applies the provided style's callout text color.SecondaryInputCallout
now uses the provided style's callout text color.View+Button
now applies shadows in a way that doesn't affect the button content.SystemKeyboard
now looks closer to the iOS system keyboards, in both dark mode and dark appearance.Background
.Foreground
instead of Tint
.standardDarkAppearance*
have been renamed to standard*ForDarkAppearance
.CalloutStyle.systemStyle
, InputCalloutStyle.systemStyle
and SecondaryInputCalloutStyle.systemStyle
are deprecated.KeyboardColor
's dark appearance cases have been renamed to keep things tight.SecondaryInputCalloutStyle
's text color property has been removed. Use the callout style's text color instead.Color.darkAppearanceStrategy
is a new, temporary property that lets you inject a custom strategy that controls whether or not to apply a dark appearance color scheme to your keyboard. This lets you work around the current color scheme bug that is described in Color+Button.swift
and override the standard strategy of always applying dark apperance colors when the keyboard context's colorScheme
is .dark
.If you find a way to determine this correctly and to work around the system behavior, please share your findings.
This version makes KeyboardKit compile for Xcode 13.0 beta 3.
From now, all new versions of KeyboardKit will support the latest Xcode version.
CGFloat+Keyboard
and EdgeInsets+Keyboard
now uses the shared vc instead of the shared application.SystemKeyboardButton
has a new contentConfig
init param that allows you to modify the button content before wrapping it in a style and applying gestures.KeyboardAction.primary
no longer applies autocomplete by default, which solves e.g. autocomplete suggestions being applied in the Safari address bar.KeyboardTextField
and KeyboardTextView
now accepts a text binding, so that you can access the typed text.KeyboardTextField
and KeyboardTextView
now share functionality through a new protocol.documentContextBeforeInput
is nil.KeyboardTextField
and KeyboardTextView
now requires a text binding.This version adjusts the colors that are used for dark keyboard appearance and dark mode keyboards, to make keyboards look better in dark appearance when in light mode.
The problem is discussed here: https://github.com/KeyboardKit/KeyboardKit/issues/285
This fix makes the button a little brighter in dark mode, but that's a lot better than having them be a little darker in dark appearance light mode. Once we figure out how to get the system color scheme when in dark appearance context, we can revisit and improve this.
This version adds features that makes it possible to add text fields and text views to the keyboard extension and automatically redirect keyboard events there instead of using the hosting app.
You can either set KeyboardInputViewController.shared.textInputProxy
directly, or use the new KeyboardTextField
and KeyboardTextView
views that does this automatically.
Proxy
namespace to which the UITextDocumentProxy
extensions have been moved.KeyboardInputViewController
has a new textInputProxy
that can be set to redirect the keyboard to that proxy instead of the original textDocumentProxy
.KeyboardTextField
and KeyboardTextView
are two new views that can be used in keyboard extensions and that will automatically redirect keyboard events to them when they become first responder.TextInputProxy
is a new class that can be used to redirect the keyboard events to any text input.KeyboardInputViewController
viewWillSyncWithTextDocumentProxy
was not used internally and has been removed. If you override this in your own keyboards, just override viewWillAppear
.