RSDInputFieldObject
open class RSDInputFieldObject : RSDSurveyInputField, RSDMutableInputField, RSDCopyInputField, Codable
RSDInputFieldObject is a Decodable implementation of the RSDSurveyInputField protocol. This is implemented as
an open class so that the decoding strategy can be used to support subclasses.
-
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
public let identifier: String -
The data type for this input field. The data type can have an associated ui hint.
Declaration
Swift
open private(set) var dataType: RSDFormDataType { get } -
A UI hint for how the study would prefer that the input field is displayed to the user.
Declaration
Swift
open private(set) var inputUIHint: RSDFormUIHint? { get } -
A localized string that displays a short text offering a hint to the user of the data to be entered for this field. This is only applicable for certain types of UI hints and data types.
Declaration
Swift
open var inputPrompt: String? -
Additional detail about this input field.
Declaration
Swift
open var inputPromptDetail: String? -
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
open var placeholder: String? -
Options for displaying a text field. This is only applicable for certain types of UI hints and data types.
Declaration
Swift
open var textFieldOptions: RSDTextFieldOptions? -
A range used by dates and numbers for setting up a picker wheel, slider, or providing text field input validation. This is only applicable for certain types of UI hints and data types.
Declaration
Swift
open var range: RSDRange? -
A Boolean value indicating whether the user can skip the input field without providing an answer.
Declaration
Swift
open var isOptional: Bool -
A list of survey rules associated with this input field.
Declaration
Swift
open var surveyRules: [RSDSurveyRule]? -
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.Declaration
Swift
open var formatter: Formatter? { get set } -
Default for the picker source is to optionally cast self.
Declaration
Swift
open var pickerSource: RSDPickerDataSource? { get } -
Default intializer.
Declaration
Swift
public init(identifier: String, dataType: RSDFormDataType, uiHint: RSDFormUIHint? = nil, prompt: String? = nil)Parameters
identifierA short string that uniquely identifies the input field within the step.
dataTypeThe data type for this input field.
uiHintA UI hint for how the study would prefer that the input field is displayed to the user.
promptA localized string that displays a short text offering a hint to the user of the data to be entered for this field.
-
Declaration
Swift
public func copy(with identifier: String) -> Self -
Swift subclass override for copying properties from the instantiated class of the
copy(with:)method. Swift does not nicely handle casting fromSelfto a class instance for non-final classes. This is a work-around.Declaration
Swift
open func copyInto(_ copy: RSDInputFieldObject) -
Validate the input field to check for any configuration that should throw an error.
Declaration
Swift
open func validate() throws -
Class function for decoding the data type from the decoder. The default implementation will key to
CodingKeys.dataType.Throws
DecodingErrorif the data type field is missing or is not aString.Declaration
Swift
public final class func dataType(from decoder: Decoder) throws -> RSDFormDataTypeParameters
decoderThe decoder used to decode this object.
Return Value
The decoded
RSDFormDataTypedata type. -
Overridable class function for decoding the
RSDTextFieldOptionsfrom the decoder. The default implementation will key toCodingKeys.textFieldOptions. If no text field options are defined in the decoder, then for certain data types, the default keyboard type is instantiated.If the data type has a
BaseTypeof aninteger, an instance ofRSDTextFieldOptionsObjectwill be created with anumberPadkeyboard type.If the data type has a
BaseTypeof adecimal, an instance ofRSDTextFieldOptionsObjectwill be created with adecimalPadkeyboard type.Throws
DecodingErrorDeclaration
Swift
open class func textFieldOptions(from decoder: Decoder, dataType: RSDFormDataType) throws -> RSDTextFieldOptions?Parameters
decoderThe decoder used to decode this object.
dataTypeThe data type associated with this instance.
Return Value
An appropriate instance of
RSDTextFieldOptionsornilif none is present. -
Initialize from a
Decoder. This decoding method will decode all the properties for this input field.Throws
DecodingErrorDeclaration
Swift
public required init(from decoder: Decoder) throwsParameters
decoderThe decoder to use to decode this instance.
-
Encode the object to the given encoder.
Throws
EncodingErrorDeclaration
Swift
public func encode(to encoder: Encoder) throwsParameters
encoderThe encoder to use to encode this instance.
View on GitHub
RSDInputFieldObject Class Reference