RSDChoicePickerTableItemGroup

open class RSDChoicePickerTableItemGroup : RSDInputFieldTableItemGroup

RSDChoicePickerTableItemGroup subclasses RSDInputFieldTableItemGroup to implement a single or multiple choice question where the choices are presented as a list.

  • Does the item group allow for multiple choices or is it single selection?

    Declaration

    Swift

    public let singleSelection: Bool
  • Default initializer.

    Declaration

    Swift

    public init(beginningRowIndex: Int, inputField: RSDInputField, uiHint: RSDFormUIHint, choicePicker: RSDChoicePickerDataSource, answerType: RSDAnswerResultType? = nil)

    Parameters

    beginningRowIndex

    The first row of the item group.

    inputField

    The input field associated with this item group.

    uiHint

    The UI hint.

    choicePicker

    The choice picker data source.

    answerType

    The answer type.

  • Override to set the selected items.

    Declaration

    Swift

    override open func setPreviousAnswer(from jsonValue: Any?) throws
  • Override to set the selected items from the result.

    Declaration

    Swift

    override open func setAnswer(from result: RSDResult) throws
  • Declaration

    Swift

    open override func setDefaultAnswerIfValid() -> Bool
  • Since the answer can be both nil and selected, override to check for selection state.

    Declaration

    Swift

    open override var isAnswerValid: Bool { get }
  • Select or de-select an item (answer) at a specific indexPath. This is used for text choice and boolean answers.

    Throws

    RSDInputFieldError if the selection is invalid.

    Declaration

    Swift

    open func select(_ item: RSDChoiceTableItem, indexPath: IndexPath) throws -> (isSelected: Bool, reloadSection: Bool)

    Parameters

    selected

    A Bool indicating if the item should be selected.

    indexPath

    The IndexPath of the item.

    Return Value

    • isSelected: The new selection state of the selected item.
    • reloadSection: true if the section needs to be reloaded b/c other answers have changed, otherwise returns false.