RSDInputField

public protocol RSDInputField

RSDInputField is used to describe a form input and includes the data type and a possible hint to how the UI should be displayed. The Research framework uses RSDFormUIStep to represent questions to ask the user. Each question must have at least one associated input field. An input field is validated when its owning step is validated.

Seealso

RSDFormUIStep
  • A short string that uniquely identifies the input field within the step. The identifier is reproduced in the results of a step result in the step history of a task result.

    Declaration

    Swift

    var identifier: String { get }
  • A localized string that displays a short text offering a hint to the user of the data to be entered for this field.

    Declaration

    Swift

    var inputPrompt: String? { get }
  • Additional detail about this input field.

    Declaration

    Swift

    var inputPromptDetail: String? { get }
  • A Boolean value indicating whether the user can skip the input field without providing an answer.

    Declaration

    Swift

    var isOptional: Bool { get }
  • The data type for this input field. The data type can have an associated ui hint.

    Declaration

    Swift

    var dataType: RSDFormDataType { get }
  • A UI hint for how the study would prefer that the input field is displayed to the user.

    Declaration

    Swift

    var inputUIHint: RSDFormUIHint? { get }
  • Validate the input field to check for any configuration that should throw an error.

    Declaration

    Swift

    func validate() throws
  • MARK: Extended protocol for an input field that can be used to enter input using a text field. A localized string that displays placeholder information for the input field.

    You can display placeholder text in a text field or text area to help users understand how to answer the item’s question.

    Declaration

    Swift

    var placeholder: String? { get }
  • Options for displaying a text field. This is only applicable for certain types of UI hints and data types. If not applicable, it will be ignored.

    Declaration

    Swift

    var textFieldOptions: RSDTextFieldOptions? { get }
  • A range used by dates and numbers for setting up a picker wheel, slider, or providing text field input validation. If not applicable, it will be ignored.

    Declaration

    Swift

    var range: RSDRange? { get }
  • A formatter that is appropriate to the data type. If nil, the format will be determined by the UI. This is the formatter used to display a previously entered answer to the user or to convert an answer entered in a text field into the appropriate value type.

    Seealso

    RSDAnswerResultType.BaseType and RSDFormStepDataSource

    Declaration

    Swift

    var formatter: Formatter? { get }
  • Optional picker source for a picker or multiple selection input field.

    Declaration

    Swift

    var pickerSource: RSDPickerDataSource? { get }