RSDChoicePickerDataSource

public protocol RSDChoicePickerDataSource : RSDPickerDataSource

A picker data source for selecting choices.

  • If this is a multiple component input field, the UI can optionally define a separator. For example, blood pressure would have a separator of /.

    Declaration

    Swift

    var separator: String? { get }
  • Returns the default answer (if any) for this picker. If nil then the UI should display empty rows initially, otherwise, the UI should display the default value.

    Declaration

    Swift

    var defaultAnswer: Any? { get }
  • Returns the number of ‘columns’ to display.

    Declaration

    Swift

    var numberOfComponents: Int { get }
  • Returns the # of rows in each component.

    Declaration

    Swift

    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.

  • Returns the choice for this row/component. If this is returns nil then this is the skip choice.

    Declaration

    Swift

    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.

  • Returns the selected answer created by the union of the selected rows.

    Declaration

    Swift

    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.

  • Returns the selected rows that match the given selected answer (if any).

    Declaration

    Swift

    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.