RSDChoiceObject
public struct RSDChoiceObject<T : Codable> : RSDChoice, RSDComparable, RSDEmbeddedIconVendor, Codable
RSDChoiceObject is a concrete implementation of RSDChoice that can be used to
track a multiple choice, single choice, or multiple component input field where each
choice in the input field maps to a specific value.
-
A JSON encodable object to return as the value when this choice is selected.
Declaration
Swift
public var value: Codable? -
Localized text string to display for the choice.
Declaration
Swift
public let text: String? -
Additional detail text.
Declaration
Swift
public let detail: String? -
For a multiple choice option, is this choice mutually exclusive? For example,
none of the above
.Declaration
Swift
public let isExclusive: Bool -
Whether or not this choice has an image associated with it that should be returned by the fetch icon method.
Declaration
Swift
public var hasIcon: Bool -
The optional
RSDImageWrapperwith the pointer to the image.Declaration
Swift
public let icon: RSDImageWrapper? -
Expected answer for the rule. In this case, it is the
valueassociated with this choice.Declaration
Swift
public var matchingAnswer: Any? -
Default initializer.
Declaration
Swift
public init(value: Value?, text: String? = nil, iconName: String? = nil, detail: String? = nil, isExclusive: Bool = false) throwsParameters
valueA JSON encodable object to return as the value when this choice is selected.
textLocalized text string to display for the choice.
iconNameThe name of the icon associated with this choice.
detailAdditional detail text.
isExclusiveFor a multiple choice option, is this choice mutually exclusive?
-
Initialize from a
Decoder. This decoding method will first look to see if the decoder contains a dictionary in which case the coding keys will be decoded from that dictionary. Otherwise, the decoder will decode a singleStringvalue and set that value as both thevalueproperty and thetextproperty.Seealso
Throws
DecodingErrorDeclaration
Swift
public init(from decoder: Decoder) throwsParameters
decoderThe decoder to use to decode this instance.
-
Encode the result to the given encoder. This will encode the choice as a dictionary.
Throws
EncodingErrorDeclaration
Swift
public func encode(to encoder: Encoder) throwsParameters
encoderThe encoder to use to encode this instance.
View on GitHub
RSDChoiceObject Structure Reference