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)
KeyboardCasing
has a new auto
case.SystemKeyboardLayoutProvider
uses the new auto
case for numeric and symbolic keyboard type switches.BaseKeyboardLayoutProvider
has been renamed to SystemKeyboardLayoutProvider
.KeyboardCasing.neutral
will be removed in KeyboardKit 5.0.KeyboardGestures
now use the drag gesture to trigger tap actions instead of a tap gesture. This increases responsiveness and ensures that taps aren't cancelled when you press for too long.KeyboardGestures
now only applies a double tap gesture if a double tap action is provided.Image.settings
has been renamed to keyboardSettings
.Image.moveCursorLeft/Right
have been renamed to keyboardLeft/Right
.This version adds new locales, external keyboard detection, dynamic type disabling and RTL locale support.
ExternalKeyboardContext
is a new iOS 14 exclusive class that lets you observe whether or not an external keyboard is connected to the device.KeyboardAction
has a new standardButtonFontSize
function.KeyboardType
has a new, context-based standardButtonImage
function that replaces the old property.KeyboardLocale
has new isLeftToRight
and isRightToLeft
properties.KeyboardType
has a new standardButtonFontSize
function.KeyboardType
has a new, context-based standardButtonText
function that replaces the old property.Locale
has new characterDirection
and lineDirection
properties.Locale
has new isLeftToRight
, isRightToLeft
, isBottomToTop
, isTopToBottom
properties.KeyboardAction
now flips the standard keyboard button image for RTL locales.SystemKeyboard
will now ignore dynamic type, just like the native keyboards.KeyboardAction
standardButtonFont
has been renamed to standardButtonUIFont
.KeyboardAction
standardButtonFontWeight
has been renamed to standardButtonUIFontWeight
.KeyboardAction
standardButtonImage
has been converted to a context-based function.KeyboardType
standardButtonText
has been converted to a context-based function.UIApplication
standardButtonTextStyle
has been renamed to standardButtonUITextStyle
.KeyboardAction+standardButtonFont
now returns a Font
instead of a UIFont
.KeyboardAction+standardButtonFontWeight
now returns a Font.Weight
instead of a UIFont.Weight
.KeyboardAction
standardButtonImage
- the property is deprecated in favor for the context-based function.standardButtonUIFont
and standardButtonUIFontWeight
.Published by danielsaidi over 3 years ago
This version adds new locales as well as features that make it easier to work with layouts and collections.
In this version, you can also identify the active app ID, which makes it possible to adjust the keyboard accordingly.
There are also several tweaks and behavior changes that make system keyboards behave even more native-like.
CGFloat
has a new standardKeyboardButtonCornerRadius
property.
DeleteBackwardRange
is a new enum can be used when deleting backwards.
EnglishKeyboardInputSetProvider
has new currency init params.
KeyboardAction.PrimaryType
has new newLine
case, that can be used to force an arrow for primary buttons.
KeyboardBehavior
has a new backspaceRange
property.
KeyboardColor
is a new enum that exposes the raw color resources.
KeyboardContext
has a new activeAppBundleId
property that identifies the currently active app.
KeyboardContext
has a new screenOrientation
property that replaces deviceOrientation
.
KeyboardPreviewMode
is a new (hopefully temporary) class that has a static enable()
function that makes SwiftUI previews work.
KeyboardInputViewController
has a new activeAppBundleId
property that identifies the currently active app.
RepeatGestureTimer
has been made public and can be used to inspect how long a repeat gesture has been active.
RowItem
is a new protocol that makes it possible to gather row collection functions in one place - Collection+RowItem
.
Collection+RowItem
has new extensions that make it easier to add and remove row items to all collections that contain the new RowItem
protocol.
EdgeInsets+Keyboard
has new context-based extensions.
UIInputViewController+Orientation
renames deviceOrientation
to screenOrientation
.
UITextDocumentProxy+Delete
has a new extension for deleting backwards a certain range.
KeyboardAction
now implements RowItem
.
iPadKeyboardLayoutProvider
has been adjusted layout buttons closer to native layouts.
iPhoneKeyboardLayoutProvider
has been adjusted layout buttons closer to native layouts.
KeyboardInput
now implements RowItem
.
KeyboardLayoutItem
now implements RowItem
.
StandardKeyboardBehavior
now only auto-switches keyboard type on .tap
.
UITextDocumentProxy
handles new lines when checking if the cursor is at new sentence.
Standard font sizes are adjusted to fit the native keyboards better.
The standard backspace range is now progressive and will increase after backspace has been pressed for a while.
KeyboardContext
deviceOrientation
has been renamed to screenOrientation
.UIApplication
preferredKeyboardInterfaceOrientation
didn't work and will be removed.UIDeviceOrientation
interfaceOrientation
is no longer used and will be removed.UIInputViewController
deviceOrientation
has been renamed to screenOrientation
.UIInterfaceOrientation
- the device orientation-based init is no longer used and will be removed.KeyboardBehavior
has a new backspaceRange
property that must be implemented.Besides the points above, KeyboardActionHandler
had a convenience handle
function that didn't require a sender
. This caused a conflict with the StandardKeyboardActionHandler
function with the same signature. Subclassing StandardKeyboardActionHandler
and calling super.handle
thus caused a never-ending loop, since the convenience function called the sender function etc.
The sender-based functions have thus been removed. If you have a custom action handler that overrides handle
or canHandle
, you must remove the sender
parameter.
This version introduces a bunch of changes to how feedback is being handled.
AudioFeedbackConfiguration
has default init param values.DragGestureHandler
is a new protocol for handling drag gestures.HapticFeedbackPlayer
is a new protocol for preparing and playing haptic feedback.KeyboardAction
has a new standardAction(for:gesture)
function.KeyboardFeedbackHandler
is a new protocol for handling keyboard feedback.KeyboardFeedbackSettings
is a new, observable settings object.KeyboardGesture
is now CaseIterable
.KeyboardInputViewController
has a new setup(with:)
that takes a UIStackView
.KeyboardInputViewController
has a new keyboardFeedbackHandler
property.KeyboardInputViewController
has a new keyboardFeedbackSettings
property.StandardHapticFeedbackPlayer
is a standard implementation that is used by default.StandardKeyboardActionHandler
has new, cleaner initializers.StandardKeyboardActionHandler
has a new triggerFeedback
function.StandardKeyboardActionHandler
has a new spaceDragGestureHandler
that is used to handle space drag gestures.StandardKeyboardFeedbackHandler
is a new, standard feedback handler.Equatable
.press
instead of tap
.StandardKeyboardActionHandler
uses the new feedback handler to trigger feedback.Feedback
.Feedback
.AudioFeedback
systemPlayer
has been renamed to player
.KeyboardInputViewController
keyboardStackView
has been replaced with a new setup(with:)
.StandardKeyboardActionHandler
has deprecated the two audio/haptic configuration-based initializers.StandardKeyboardActionHandler
audioConfiguration
is deprecated and converted to a computed property.StandardKeyboardActionHandler
hapticConfiguration
is deprecated and converted to a computed property.StandardKeyboardActionHandler
spaceDragSensitivity
is deprecated.StandardKeyboardActionHandler
handleSpaceCursorDragGesture
is deprecated.StandardKeyboardActionHandler
triggerAudioFeedback
is deprecated.StandardKeyboardActionHandler
triggerHapticFeedback
is deprecated.StandardKeyboardActionHandler
triggerHapticFeedbackForLongPressOnSpaceDragGesture
is deprecated.This version adds support for primary actions, such as .done
, .go
, .search
etc.
BaseKeyboardLayoutProvider
has a new, open keyboardReturnAction(for:)
function.KeyboardAction
has a new standardTextDocumentProxyAction
.KeyboardAction
has a new standardTextDocumentProxyInputAction
.KeyboardAction.primary
is a new action type that gathers all primary action types.KKL10n
has new text(for:)
functions that let you translate keys for specific contexts and locales.String+sentenceDelimiters
and wordDelimiters
can now be modified, if you have specific needs.return
with done
, go
and search
when applicable.$
.word
delimiter instead of a sentence
delimiter.KeyboardAction
.done
, .go
, .ok
and .search
have been deprecated and replaced with the new primary
umbrella type.This version is all about locales and autocomplete, overall:
This version adds support for danish
, finnish
, norwegian
and dutch
.
This version also adds many new features aimed at an improved autocomplete experience.
KeyboardKit Pro 4.1 also adds more locale-specific providers as well as a real autocomplete engine.
AutocompleteSpaceState
is a new enum that is used to keep track of how aAutocompleteSuggestion
has new isAutocomplete
and isUnknown
properties.AutocompleteSuggestionProvider
has new functions for ignoring and learning words.AutocompleteToolbar
has a new itemBuilder
initializer.AutocompleteToolbarItem
is a new view that replicates a native autocomplete item.AutocompleteToolbarItemText
is a new view that replicates the text of a native autocomplete item.KeyboardAction
has a new isSpace
property.KeyboardAction
has a new shouldApplyAutocompleteSuggestion
property.KeyboardAction
has a new shouldReinsertAutocompleteInsertedSpace
property.KeyboardAction
has a new shouldRemoveAutocompleteInsertedSpace
property.KeyboardLocale
now implementes Identifiable
.KeyboardLocale
has new flag
, id
and localeIdentifier
properties.KeyboardLocale
has new sorted
collection extensions.KeyboardInputViewController
has a new autocompleteSuggestionProvider
property.KeyboardInputViewController
has now implemented performAutocomplete
and resetAutocomplete
.StandardKeyboardActionHandler
has a new tryApplyAutocompleteSuggestion
function.StandardKeyboardActionHandler
has a new tryHandleReplacementAction
function.StandardKeyboardActionHandler
has a new tryReinsertAutocompleteRemovedSpace
function.StandardKeyboardActionHandler
has a new tryRemoveAutocompleteInsertedSpace
function.SystemKeyboardSpaceButtonContent
has a new initializer that lets you inject a custom space view.UITextDocumentProxy
has a new hasAutocompleteInsertedSpace
property.UITextDocumentProxy
has a new hasAutocompleteRemovedSpace
property.UITextDocumentProxy
has a new insertAutocompleteSuggestion
function.UITextDocumentProxy
has a new isOpenAlternateQuotationBeforeInput(for:)
function.UITextDocumentProxy
has a new isOpenQuotationBeforeInput(for:)
function.UITextDocumentProxy
has a new preferredReplacement(for:locale:)
function.UITextDocumentProxy
has a new tryInsertSpaceAfterAutocomplete)
function.UITextDocumentProxy
has a new tryReinsertAutocompleteRemovedSpace
function.UITextDocumentProxy
has a new tryRemoveAutocompleteInsertedSpace
function.KeyboardInputViewController
now uses combine observations to keep locale in sync.AutocompleteSuggestion+replacement
has been renamed to text
.AutocompleteToolbar+ButtonBuilder
has been renamed to ItemBuilder
.KeyboardLocale+key
has been renamed to id
.LocaleKey
has been renamed to KeyboardLocale
.AutocompleteSuggestion+replacement
has been deprecated due to the name change above.AutocompleteToolbar+buttonBuilder
init has been deprecated and replaced with the itemBuilder
one.AutocompleteToolbar+standardReplacement
has been deprecated.LocaleKey
has been deprecated due to the name change above.KeyboardLocale+key
has been deprecated.KeyboardInputViewController+changeKeyboardLocale
has been deprecated.KeyboardInputViewController+changeKeyboardType
has been deprecated.AutocompleteSuggestionProvider
has new properties and functions that must be implemented. If you have an instance that breaks, just create dummy implementations that does nothing.This patch fixes a few minor things:
.done
was accidentally missing a localized text.In the shadows no more! It's time for SwiftUI
to rise and become the unrelenting force we always knew it would become.
KeyboardKitSwiftUI
has been merged into this repository and the deployment target is raised to iOS 13
.
SwiftUI support is a first-class citizen from now on. UIKit
support is still around, but will no longer be actively developed. The future is a bright, declarative one!
Although these release notes aim at covering everything that has changes in this major version, some things will most probably be missed.
Besides the new things listed below, there are a bunch of new extensions, images etc.
Callouts
has new types and providers for working with callouts.Image.emoji
no longer requires iOS 14, but uses person.crop.circle
as fallback on iOS 13.Input
has new types and providers for working with keyboard layouts.KeyboardAction
has new actions - go
, nextLocale
, ok
and return
.KeyboardAction
has new, localized standard button texts for some actions.KeyboardAction
has new isPrimaryAction
property.KeyboardAction
has new standardButtonFontWeight
property.KeyboardAppearance
has a new image(for:)
.KeyboardCasing
has a new neutral
case that can be used to show the original state of the inputs.KeyboardContext
has a new locales
list and a new selectNextLocale
function.KeyboardGesture
has new press
and release
gestures.KeyboardInput
is a new input type that simplifies building unicode-based keyboards.KeyboardInputSet
is now based on KeyboardInput
s instead of strings.KeyboardInputViewController
has a new static shared
instance.KeyboardInputViewController
has a new keyboardActionHandler
.KeyboardInputViewController
has a new keyboardAppearance
.KeyboardInputViewController
has a new keyboardBehavior
.KeyboardInputViewController
has a new keyboardContext
.KeyboardInputViewController
has a new keyboardInputCalloutContext
.KeyboardInputViewController
has a new keyboardInputSetProvider
.KeyboardInputViewController
has a new keyboardLayoutProvider
.KeyboardInputViewController
has a new keyboardSecondaryInputActionProvider
.KeyboardInputViewController
has a new keyboardSecondaryInputCalloutContext
.KeyboardInputViewController
setup(with:)
is now open and overridable.KeyboardEnabledState
is a new observable class that keeps in sync with the keyboard enabled state.KeyboardLayoutProvider
has a new register(inputSetProvider:)
to simplify changing global input set provider.Layout
has new types and providers for working with keyboard layouts.Locale
is a new namespace with a few new locale-specific utils.LocaleDictionary
is a simple dictionary wrapper to work with localized resources.LocaleKey
is a simple enum to gather top-level locale identifiers.KKL10n
is a new enum that provides localized strings from KeyboardKit.SystemKeyboard
now highlights buttons when typing on iPad.View
has new keyboardInputViewController
convenience extensions.View+keyboardToast
has new context-based function.View+localeContextMenu
can be applied to any view to let the user change locale.AutocompleteContext
is now an observable object and not a protocol.AutocompleteToolbar
is now generic, which makes your .AutocompleteToolbar
now uses identifiable bar items, which leads to better separator handling.AutocompleteToolbar
now takes suggestions at init and doesn't require an environment injected AutocompleteContext
.AutocompleteToolbar
no longer requires an environment injected ObservableKeyboardContext
, nor does its builder functions.EmojiCategory
now uses the Emoji
type instead of a char.FrequentEmojiProvider
now uses the Emoji
type instead of a char.KeyboardAction
standardButtonFont
has been coverted to a function.KeyboardAction
standardButtonText
has been coverted to a function.KeyboardAction
standardButtonTextStyle
has been coverted to a function.KeyboardAction.emoji
now uses the Emoji
type instead of a char.KeyboardAction.emojiCategory
no longer has a standard tap action.KeyboardActionRow
standardButtonImage
no longer takes a context.KeyboardBehavior
no longer takes a context as function input.KeyboardContext
is now an observable object and not a protocol.KeyboardContext
no longer has any services, just inspectable properties.KeyboardGestures
now handles the new press and release gestures.KeyboardInputSetProvider
implementations now provides punctuation as well.KeyboardInputSetProvider
no longer takes a context as function input.KeyboardInputViewController
context
is now an ObservableKeyboardContext
.KeyboardInputViewController
context
is now called keyboardContext
.SecondaryCalloutActionProvider
no longer takes a context as function input.SecondaryInputCalloutContext
no longer requires a context init parameter.StandardKeyboardActionHandler
no longer depends on an input view controller.StandardKeyboardActionHandler
now requires an injected keyboard context and behavior.StandardKeyboardActionHandler
now requires an injected autocomplete and keyboard change action.StandardKeyboardActionHandler
now handles the new press and release gestures.StandardKeyboardActionHandler
triggerAutocomplete
is replaced by an injectable function.StandardKeyboardAppearance
will use isPrimaryAction
to apply a blue color to those actions.StandardKeyboardAppearance
will fallback to the action's standard font weight instead of nil
.StandardKeyboardBehavior
now requires an injected keyboard context.StandardKeyboardInputSetProvider
now requires an injected keyboard context.View+KeyboardGestures
now handles the new press and release gestures.InputCalloutContext.shared
has been removed. Use the environment object instead.KeyboardAction+SecondaryCalloutActions
has been replaced with new Callouts/Providers
providers.KeyboardActionRow
has been removed, since it's confusing to have two aliases for the same thing.KeyboardAppearance
button properties are prefixed with button
.KeyboardAppearance
font
and fontWeight
have been merged into a single font
property.KeyboardAppearanceProvider
has been renamed to KeyboardAppearance
.KeyboardButtonWidth
has been renamed to KeyboardLayoutWidth
.KeyboardContext
actionHandler
has been moved to the input vc.KeyboardContext
keyboardAppearanceProvider
has been moved to the input vc.KeyboardContext
keyboardBehavior
has been moved to the input vc.KeyboardContext
keyboardInputSetProvider
has been moved to the input vc.KeyboardContext
keyboardLayoutProvider
has been moved to the input vc.KeyboardDimensions
is no longer used and has been removed.KeyboardInputSet
locale extensions have been removed.KeyboardInputSet
standard input set extensions have been removed.KeyboardInputViewController
addKeyboardGestures
has been converted to KeyboardButton+Gestures
.KeyboardInputViewController
context
has been renamed to keyboardContext
.KeyboardInputViewController
keyboardType
has been removed - use the context directly!KeyboardInputViewController
setupKeyboard
has been removed and moved to the UIKit demo.KeyboardInputViewController+Gestures
has been converted to KeyboardButton+Gestures
.KeyboardLayout
actionRows
has been renamed to items
and are of a new KeyboardLayoutItemRows
type.KeyboardCasing
has been renamed to KeyboardCasing
KeyboardStateInspector
has been renamed to KeyboardEnabledStateInspector
.ObservableAutocompleteContext
has been renamed to AutocompleteContext
.ObservableKeyboardContext
has been renamed to KeyboardContext
.PhotosImageService
and StandardPhotosImageService
have been removed.Settings
has been entirely removed.SecondaryInputCalloutContext.shared
has been removed. Use the environment object instead.StandardKeyboardContext
has been replaced by ObservableKeyboardContext
.StandardKeyboardActionHandler
has a new vc-based initializer.StandardKeyboardActionHandler
no longer takes an optional sender for keyboard actions.StandardKeyboardActionHandler
gesture actions has been gathered in a single action(for:on)
.StandardKeyboardAppearanceProvider
has been renamed to StandardKeyboardAppearance
.StandardKeyboardLayoutProvider
no longer has left and right space actions. Implement this in a custom provider instead.SystemKeyboardDimensions
is no longer used and has been removed.UIImage+pasteboard
has been moved to the demo.UIImage+photos
has been moved to the demo.UIImage+resized
has been removed.UIImage+tinted
has been removed.UIInputViewController+NextKeyboard
has been made an internal extension in UIView+Keyboard
.View+Button
"standard button" functions have been replaced by a single keyboardButtonStyle
function.View+ClearInteractable
has been removed.View
keyboardAction(...)
has been renamed to keyboardGestures(for: ...)
.UIEdgeInsets+Keyboard
standardKeyboardButtonInsets
has been renamed to standardKeyboardButtonInsets
.In this version, UIKit
is replaced by SwiftUI
as the primary layout engine.
As such, to avoid UIKit
parts blocking SwiftUI, types in the UIKit
folder will be renamed to start with UI
:
AutocompleteToolbarLabel
-> UIAutocompleteToolbarLabel
AutocompleteToolbarSeparator
-> UIAutocompleteToolbarSeparator
AutocompleteToolbarView
-> UIAutocompleteToolbar
(OBS! Name change as well.)HorizontalKeyboardComponent
-> UIHorizontalKeyboardComponent
KeyboardAlert
-> UIKeyboardAlert
KeyboardButton
-> UIKeyboardButton
KeyboardButtonCollectionView
-> UIKeyboardButtonCollectionView
KeyboardButtonRowCollectionView
-> UIKeyboardButtonRowCollectionView
KeyboardButtonView
-> UIKeyboardButtonView
KeyboardButtonRowComponent
-> UIKeyboardButtonRowComponent
KeyboardCollectionView
-> UIKeyboardCollectionView
KeyboardToolbarComponent
-> UIKeyboardToolbarComponent
KeyboardToolbarView
-> UIKeyboardToolbarView
KeyboardSpacerView
-> UIKeyboardSpacerView
KeyboardStackViewComponent
-> UIKeyboardStackViewComponent
PagedKeyboardComponent
-> UIPagedKeyboardComponent
RepeatingGestureRecognizer
-> UIRepeatingGestureRecognizer
Shadow
-> UIShadow
ToastAlert
-> UIKeyboardToastAlert
(OBS! Name change as well.)VerticalKeyboardComponent
-> UIVerticalKeyboardComponent
Their functionality remains intact, however.
There are a new extension as well, as UIKit support moves away from the core layer:
UIView+Keyboard
is now used to apply button gestures to a view, instead of having this functionality in the view controller.This release adds fake protocol implementations, to simplify creating SwiftUI previews.
The release also adds some things for the future:
KeyboardButtonWidth
is a new way to express the width of a keyboard button.View+KeyboardButtonWidth
is a new way to apply a width to a keyboard button.Although not used by the standard keyboards yet, I still wanted to add them before starting working on 4.0.
This release fixes so that the secondary input gesture triggers a tap if there were no secondary actions in the callout.
Emoji
is a new struct that in the future will let us work more with emojis in a more structured and type-safe way.
EmojiCategory
now lets you register a frequentEmojiProvider
, and uses that to populate the frequent category.
There is a new EmojiProvider
protocol
There is a new FrequentEmojiProvider
protocol
There is a new MostRecentEmojiProvider
class
There is a new String+Delimiters
extension with word and sentence delimiters.
There are new UITextDocumentProxu+Content
extensions to get previous sentences and words.
AutocompleteToolbar
has a new, static standardReplacement
function.
AutocompleteToolbar
has a new, static standardReplacementAction
function.
AutocompleteToolbar
now lets you provide an optional, custom replacementAction
in init.
Color+Resources
is a new extension that provides asset-based colors that adapt to dark mode.
EmojiCategoryKeyboard
is a new view that lists the emojis of a selected category and a menu.
EmojiCategoryKeyboardMenu
is a new view that lets the user select one of multiple categories.
EmojiKeyboard
is a new view that renders a set of emojis in a lazy grid. The item action is customizable.
EmojiCategory
now implements EmojiProvider
EmojiCategory.frequent
now returns emojis from the frequentEmojiProvider
.
StandardKeyboardActionHandler
now tries to register emojis with the EmojiCategory
frequent emoji provider.
Color+Button
uses the new asset-based colors.
SystemKeyboardButtonBody
now only offsets small caps texts.
The emoji action has a filled standard image instead of an outlined one.
Due to a secondary callout action bug, the secondary context is now created by the vc.
ยด
accent was accidentally used in standard numeric keyboards. It has now been replaced with โ
, which is the correct one.KeyboardContext.emojiCategory
has been deprecated. This should be persisted by the view instead.
PhotosImageService
and the standard implementation has been deprecated. Copy it to your own project if you want to keep on using it.
UIImage+Photos
has been deprecated. Copy it to your own project if you want to keep on using it.
Some button-specific Color
extensions have been deprecated.
View+keyboardAction(:context:)
has been deprecated.
secondaryCalloutInputProvider
has been removed from KeyboardContext
. It's now only in the secondary context.