RSDComparableSurveyRuleObject
public struct RSDComparableSurveyRuleObject<T> : RSDComparableSurveyRule, Codable where T : Decodable, T : Encodable
RSDComparableSurveyRuleObject is a survey rule that matches an expected result to the answer and vends a skip
identifier if the match is evaluated to true.
-
Optional skip identifier for this rule. If available, this will be used as the skip identifier, otherwise the
skipToIdentifierwill be assumed to beRSDIdentifier.exitDeclaration
Swift
public let skipToIdentifier: String? -
Optional cohort to assign if the rule matches. If available, then an
RSDCohortRulecan be used to track the cohort to assign depending upon how this rule evaluates.Declaration
Swift
public let cohort: String? -
The rule operator to apply. If
nil,.equalwill be assumed unless theexpectedAnsweris also nil, in which case.skipwill be assumed.Declaration
Swift
public let ruleOperator: RSDSurveyRuleOperator? -
Expected answer for the rule. If
nil, then the operator must be .skip or this will return a nil value.Declaration
Swift
public var matchingAnswer: Any? { get } -
Default initializer.
Declaration
Swift
public init(skipToIdentifier: String?, matchingValue: Value?, ruleOperator: RSDSurveyRuleOperator?, cohort: String? = nil)Parameters
skipToIdentifierSkip identifier for this rule.
matchingValueValue-typed matching answer.
ruleOperatorThe rule operator to apply.
cohortThe cohort to assign for this rule if it matches.
-
Initialize from a
Decoder. This method will decode the values and also check that the combination of inputs is valid.Throws
DecodingErrorif there is a decoding error.Declaration
Swift
public init(from decoder: Decoder) throwsParameters
decoderThe decoder to use to decode this instance.
View on GitHub
RSDComparableSurveyRuleObject Structure Reference