SDLKeyboardDelegate Protocol Reference

Section Contents

Overview

They delegate of a keyboard popup allowing customization at runtime of the keyboard.

-userDidSubmitInput:withEvent:

The keyboard session completed with some input.

This will be sent upon ENTRY_SUBMITTED or ENTRY_VOICE. If the event is ENTRY_VOICE, the user requested to start a voice session in order to submit input to this keyboard. This MUST be handled by you. Start an Audio Pass Thru session if supported.

Objective-C

- (void)userDidSubmitInput:(nonnull NSString *)inputText
                 withEvent:(nonnull SDLKeyboardEvent)source;

Swift

func userDidSubmitInput(_ inputText: String, withEvent source: SDLKeyboardEvent)

Parameters

inputText

The submitted input text on the keyboard

source

ENTRY_SUBMITTED if the user pressed the submit button on the keyboard, ENTRY_VOICE if the user requested that a voice session begin

-keyboardDidAbortWithReason:

The keyboard session aborted.

This will be sent if the keyboard event ENTRY_CANCELLED or ENTRY_ABORTED is sent

Objective-C

- (void)keyboardDidAbortWithReason:(nonnull SDLKeyboardEvent)event;

Swift

func keyboardDidAbort(withReason event: SDLKeyboardEvent)

Parameters

event

ENTRY_CANCELLED if the user cancelled the keyboard input, or ENTRY_ABORTED if the system aborted the input due to a higher priority event

-customKeyboardConfiguration

Implement this in order to provide a custom keyboard configuration to just this keyboard. To apply default settings to all keyboards, see SDLScreenManager.keyboardConfiguration

Objective-C

- (nonnull SDLKeyboardProperties *)customKeyboardConfiguration;

Swift

optional func customKeyboardConfiguration() -> SDLKeyboardProperties

Return Value

The custom keyboard configuration to use.

-updateAutocompleteWithInput:autoCompleteResultsHandler:

Implement this if you wish to updated the KeyboardProperties.autoCompleteList as the user updates their input. This is called upon a KEYPRESS event.

This allows you to present a list of options that the user can use to fill in the search / text box with suggestions you provide.

Objective-C

- (void)updateAutocompleteWithInput:(nonnull NSString *)currentInputText
         autoCompleteResultsHandler:
             (nonnull SDLKeyboardAutoCompleteResultsHandler)resultsHandler;

Swift

optional func updateAutocomplete(withInput currentInputText: String, autoCompleteResultsHandler resultsHandler: @escaping SDLKeyboardAutoCompleteResultsHandler)

Parameters

currentInputText

The user’s full current input text

resultsHandler

A completion handler to update the autoCompleteList

-updateCharacterSetWithInput:completionHandler:

Implement this if you wish to update the limitedCharacterSet as the user updates their input. This is called upon a KEYPRESS event.

Objective-C

- (void)updateCharacterSetWithInput:(nonnull NSString *)currentInputText
                  completionHandler:
                      (nonnull SDLKeyboardCharacterSetCompletionHandler)
                          completionHandler;

Swift

optional func updateCharacterSet(withInput currentInputText: String) async -> [String]?

Parameters

currentInputText

The user’s full current input text

completionHandler

A completion handler to update the limitedCharacterSet

-keyboardDidSendEvent:text:

Implement this to be notified of all events occurring on the keyboard

Objective-C

- (void)keyboardDidSendEvent:(nonnull SDLKeyboardEvent)event
                        text:(nonnull NSString *)currentInputText;

Swift

optional func keyboardDidSendEvent(_ event: SDLKeyboardEvent, text currentInputText: String)

Parameters

event

The event that occurred

currentInputText

The user’s full current input text

-keyboardDidUpdateInputMask:

Implement this to be notified of input key mask update (whether or not the user has changed the input to be hidden, like passwords)

Objective-C

- (void)keyboardDidUpdateInputMask:(BOOL)isEnabled;

Swift

optional func keyboardDidUpdateInputMask(_ isEnabled: Bool)

Parameters

isEnabled

- YES if the mask is enabled, NO if the mask is disabled @added in SmartDeviceLink 7.1.0