Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
To Top Created with Sketch. To Top
To Bottom Created with Sketch. To Bottom
iOS Documentation
SDLChoiceSet

SDLChoiceSet Class Reference

Section Contents

Overview

The choice set to be displayed to the user. Contains a list of selectable options.

defaultTimeout

Set this to change the default timeout for all choice sets. If a timeout is not set on an individual choice set object (or if it is set to 0.0), then it will use this timeout instead. See timeout for more details. If this is not set by you, it will default to 10 seconds. The minimum is 5 seconds, the maximum is 100 seconds. If this is set below the minimum, it will be capped at 5 seconds. If this is set above the maximum, it will be capped at 100 seconds.

Objective-C

@property (class, nonatomic) NSTimeInterval defaultTimeout;

Swift

class var defaultTimeout: TimeInterval { get set }

defaultLayout

Set this to change the default layout for all choice sets. If a layout is not set on an individual choice set object, then it will use this layout instead. See layout for more details. If this is not set by you, it will default to SDLChoiceSetLayoutList.

Objective-C

@property (class, nonatomic) SDLChoiceSetLayout defaultLayout;

Swift

class var defaultLayout: SDLChoiceSetLayout { get set }

title

Maps to PerformInteraction.initialText. The title of the choice set, and/or the initial text on a keyboard prompt.

Objective-C

@property (nonatomic, copy) NSString *_Nonnull title;

Swift

var title: String { get set }

initialPrompt

Maps to PerformInteraction.initialPrompt. The initial prompt spoken to the user at the start of an interaction.

Objective-C

@property (nonatomic, copy, nullable) NSArray<SDLTTSChunk *> *initialPrompt;

Swift

var initialPrompt: [SDLTTSChunk]? { get set }

layout

Maps to PerformInteraction.interactionLayout. Whether the presented choices are arranged as a set of tiles or a list.

Objective-C

@property (nonatomic) SDLChoiceSetLayout layout;

Swift

var layout: SDLChoiceSetLayout { get set }

timeout

Maps to PerformInteraction.timeout. Timeout in seconds. Defaults to 0, which will use defaultTimeout. If this is set below the minimum, it will be capped at 5 seconds. Minimum 5 seconds, maximum 100 seconds. If this is set above the maximum, it will be capped at 100 seconds. Defaults to 0.

Note

This applies only to a manual selection (not a voice selection, which has its timeout handled by the system).

Objective-C

@property (nonatomic) NSTimeInterval timeout;

Swift

var timeout: TimeInterval { get set }

timeoutPrompt

Maps to PerformInteraction.timeoutPrompt. This text is spoken when a VR interaction times out. If this set is presented in a manual (non-voice) only interaction, this will be ignored.

Objective-C

@property (nonatomic, copy, nullable) NSArray<SDLTTSChunk *> *timeoutPrompt;

Swift

var timeoutPrompt: [SDLTTSChunk]? { get set }

helpPrompt

Maps to PerformInteraction.helpPrompt. This is the spoken string when a user speaks “help” when the interaction is occurring.

Objective-C

@property (nonatomic, copy, nullable) NSArray<SDLTTSChunk *> *helpPrompt;

Swift

var helpPrompt: [SDLTTSChunk]? { get set }

helpList

Maps to PerformInteraction.vrHelp. This is a list of help text presented to the user when they are in a voice recognition interaction from your choice set of options. If this set is presented in a touch only interaction, this will be ignored.

Note

that while SDLVRHelpItem’s position will be automatically set based on position in the array, the image will need to uploaded by you before use using SDLFileManager.

Objective-C

@property (nonatomic, copy, nullable) NSArray<SDLVRHelpItem *> *helpList;

Swift

var helpList: [SDLVRHelpItem]? { get set }

delegate

The delegate of this choice set, called when the user interacts with it.

Objective-C

@property (nonatomic, weak) id<SDLChoiceSetDelegate> _Nullable delegate;

choices

The choices to be displayed to the user within this choice set. These choices could match those already preloaded via SDLScreenManager preloadChoices:withCompletionHandler:.

This is limited to 100 items. If you attempt to set more than 100 items, the set will not have any items (this array will be empty).

Objective-C

@property (nonatomic, copy) NSArray<SDLChoiceCell *> *_Nonnull choices;

Swift

var choices: [SDLChoiceCell] { get set }

-init

Initialize with a title, delegate, and choices. It will use the default timeout and layout, all other properties (such as prompts) will be nil.

WARNING: If you display multiple cells with the same text with the only uniquing property between cells being different vrCommands or a feature that is not displayed on the head unit (e.g. if the head unit doesn’t display secondaryArtwork and that’s the only uniquing property between two cells) then the cells may appear to be the same to the user in Manual mode. This only applies to RPC connections >= 7.1.0.

WARNING: On < 7.1.0 connections, the text cell will be automatically modified among cells that have the same text when they are preloaded, so they will always appear differently on-screen when they are displayed. cell.uniqueText will be created by appending (2), (3), etc.

Objective-C

- (nonnull instancetype)init;

Swift

init()

-initWithTitle:delegate:choices:

Initialize with a title, delegate, and choices. It will use the default timeout and layout, all other properties (such as prompts) will be nil.

WARNING: If you display multiple cells with the same text with the only uniquing property between cells being different vrCommands or a feature that is not displayed on the head unit (e.g. if the head unit doesn’t display secondaryArtwork and that’s the only uniquing property between two cells) then the cells may appear to be the same to the user in Manual mode. This only applies to RPC connections >= 7.1.0.

WARNING: On < 7.1.0 connections, the text cell will be automatically modified among cells that have the same text when they are preloaded, so they will always appear differently on-screen when they are displayed. cell.uniqueText will be created by appending (2), (3), etc.

Objective-C

- (nonnull instancetype)initWithTitle:(nonnull NSString *)title
                             delegate:(nonnull id<SDLChoiceSetDelegate>)delegate
                              choices:
                                  (nonnull NSArray<SDLChoiceCell *> *)choices;

Parameters

title

The choice set’s title

delegate

The choice set delegate called after the user has interacted with your choice set

choices

The choices to be displayed to the user for interaction

Return Value

The choice set

-initWithTitle:delegate:layout:timeout:initialPromptString:timeoutPromptString:helpPromptString:vrHelpList:choices:

Initializer with all possible properties.

WARNING: If you display multiple cells with the same text with the only uniquing property between cells being different vrCommands or a feature that is not displayed on the head unit (e.g. if the head unit doesn’t display secondaryArtwork and that’s the only uniquing property between two cells) then the cells may appear to be the same to the user in Manual mode. This only applies to RPC connections >= 7.1.0.

WARNING: On < 7.1.0 connections, the text cell will be automatically modified among cells that have the same text when they are preloaded, so they will always appear differently on-screen when they are displayed. cell.uniqueText will be created by appending (2), (3), etc.

Objective-C

- (nonnull instancetype)
          initWithTitle:(nonnull NSString *)title
               delegate:(nonnull id<SDLChoiceSetDelegate>)delegate
                 layout:(SDLChoiceSetLayout)layout
                timeout:(NSTimeInterval)timeout
    initialPromptString:(nullable NSString *)initialPrompt
    timeoutPromptString:(nullable NSString *)timeoutPrompt
       helpPromptString:(nullable NSString *)helpPrompt
             vrHelpList:(nullable NSArray<SDLVRHelpItem *> *)helpList
                choices:(nonnull NSArray<SDLChoiceCell *> *)choices;

Parameters

title

The choice set’s title

delegate

The choice set delegate called after the user has interacted with your choice set

layout

The layout of choice options (Manual/touch only)

timeout

The timeout of a touch interaction in seconds (Manual/touch only)

initialPrompt

A voice prompt spoken to the user when this set is displayed

timeoutPrompt

A voice prompt spoken to the user when the set times out (Voice only)

helpPrompt

A voice prompt spoken to the user when the user asks for “help”

helpList

A table list of text and images shown to the user during a voice recognition session for this choice set (Voice only)

choices

The list of choices presented to the user either as a manual/touch interaction or via the user’s voice

Return Value

The choice set

-initWithTitle:delegate:layout:timeout:initialPrompt:timeoutPrompt:helpPrompt:vrHelpList:choices:

Initializer with all possible properties.

WARNING: If you display multiple cells with the same text with the only uniquing property between cells being different vrCommands or a feature that is not displayed on the head unit (e.g. if the head unit doesn’t display secondaryArtwork and that’s the only uniquing property between two cells) then the cells may appear to be the same to the user in Manual mode. This only applies to RPC connections >= 7.1.0.

WARNING: On < 7.1.0 connections, the text cell will be automatically modified among cells that have the same text when they are preloaded, so they will always appear differently on-screen when they are displayed. cell.uniqueText will be created by appending (2), (3), etc.

Objective-C

- (nonnull instancetype)
    initWithTitle:(nonnull NSString *)title
         delegate:(nonnull id<SDLChoiceSetDelegate>)delegate
           layout:(SDLChoiceSetLayout)layout
          timeout:(NSTimeInterval)timeout
    initialPrompt:(nullable NSArray<SDLTTSChunk *> *)initialPrompt
    timeoutPrompt:(nullable NSArray<SDLTTSChunk *> *)timeoutPrompt
       helpPrompt:(nullable NSArray<SDLTTSChunk *> *)helpPrompt
       vrHelpList:(nullable NSArray<SDLVRHelpItem *> *)helpList
          choices:(nonnull NSArray<SDLChoiceCell *> *)choices;

Parameters

title

The choice set’s title

delegate

The choice set delegate called after the user has interacted with your choice set

layout

The layout of choice options (Manual/touch only)

timeout

The timeout of a touch interaction in seconds (Manual/touch only)

initialPrompt

A voice prompt spoken to the user when this set is displayed

timeoutPrompt

A voice prompt spoken to the user when the set times out (Voice only)

helpPrompt

A voice prompt spoken to the user when the user asks for “help”

helpList

A table list of text and images shown to the user during a voice recognition session for this choice set (Voice only)

choices

The list of choices presented to the user either as a manual/touch interaction or via the user’s voice

Return Value

The choice set

-cancel

Cancels the choice set. If the choice set has not yet been sent to Core, it will not be sent. If the choice set is already presented on Core, the choice set will be immediately dismissed. Canceling an already presented choice set will only work if connected to Core versions 6.0+. On older versions of Core, the choice set will not be dismissed.

Objective-C

- (void)cancel;

Swift

func cancel()
View on GitHub.com
Previous Section Next Section