RSDChoiceOptions
public protocol RSDChoiceOptions : RSDChoicePickerDataSource
RSDChoiceOptions
is a data source protocol that can be used to set up a picker or list of choices.
-
A list of choices for the input field.
Declaration
Swift
var choices: [RSDChoice] { get }
-
A Boolean value indicating whether the user can skip the input field without providing an answer.
Declaration
Swift
var isOptional: Bool { get }
-
numberOfComponents
Extension methodReturns the number of ‘columns’ to display.
Declaration
Swift
public var numberOfComponents: Int { get }
-
numberOfRows(in:)
Extension methodReturns the # of rows in each component.
Declaration
Swift
public func numberOfRows(in component: Int) -> Int
Parameters
component
The component (or column) of the picker.
Return Value
The number of rows in the given component.
-
choice(forRow:forComponent:)
Extension methodReturns the choice for this row/component. If this is returns
nil
then this is theskip
choice.Declaration
Swift
public func choice(forRow row: Int, forComponent component: Int) -> RSDChoice?
Parameters
row
The row for the selected component.
component
The component (or column) of the picker.
-
selectedAnswer(with:)
Extension methodReturns the selected answer created by the union of the selected rows.
Declaration
Swift
public func selectedAnswer(with selectedRows: [Int]) -> Any?
Parameters
selectedRows
The selected rows, where there is a selected row for each component.
Return Value
The answer created from the given array of selected rows.
-
selectedRows(from:)
Extension methodReturns the selected rows that match the given selected answer (if any).
Declaration
Swift
public func selectedRows(from selectedAnswer: Any?) -> [Int]?
Parameters
selectedAnswer
The selected answer.
Return Value
The selected rows, where there is a selected row for each component, or
nil
if not all rows are selected. -
textAnswer(from:)
Extension methodReturns the text answer to display for a given selected answer.
Declaration
Swift
public func textAnswer(from selectedAnswer: Any?) -> String?
Parameters
selectedAnswer
The answer to convert.
Return Value
A text value for the answer to display to the user.
-
hasImages
Extension methodConvenience property for whether or not the choice input field has associated images.
Declaration
Swift
public var hasImages: Bool { get }
-
separator
Extension methodThe separator is not used with only one column of choices.
Declaration
Swift
public var separator: String? { get }