RSDSurveyNavigationStep
public protocol RSDSurveyNavigationStep : RSDNavigationRule
RSDSurveyNavigationStep
evaluates RSDSurveyRule
objects that are associated with each input field to determine
if the step navigation should skip to another step.
-
Identifier to skip to if all input fields have nil answers.
Declaration
Swift
var skipToIfNil: String? { get }
-
The input fields to test as a part of this navigation.
Declaration
Swift
var inputFields: [RSDInputField] { get }
-
evaluateSurveyRules(with:isPeeking:)
Extension methodEvaluate the survey rules for the given task result and return the next identifier.
This method inspects all the survey rules and will return a value under the following conditions:
- If all the results are
nil
andisPeeking
equalsfalse
, then it will return the value ofskipToIfNil
If one and only one skip identifier is returned by the evaluated survey rules.
Note
RSDSurveyNavigationStep
extendsRSDNavigationRule
but does not implement thenextStepIdentifier()
method because that will allow for additional customization by the step that is implementing this protocol.Seealso
RSDFormUIStepObject
for an example implementation.- result: The task result to evaluate.
- isPeeking: Is this navigation rule being called on a result for a step that is navigating forward or is it a step navigator that is peeking at the next step to set up UI display? If peeking at the next step then this parameter will be
true
.Declaration
Swift
public func evaluateSurveyRules(with result: RSDTaskResult?, isPeeking: Bool) -> String?
Parameters
result
The task result to evaluate.
isPeeking
Is this navigation rule being called on a result for a step that is navigating forward or is it a step navigator that is peeking at the next step to set up UI display? If peeking at the next step then this parameter will be
true
.Return Value
The identifier for the step to skip to if the rules are
true
. - If all the results are
-
evaluateCohortsToApply(with:)
Extension methodEvaluate the survey rules for the given task result and return the cohorts that should be added or removed based on the result.
Note
RSDSurveyNavigationStep
extendsRSDCohortAssignmentStep
but does not implement thecohortsToApply()
method because that will allow for additional customization by the step that is implementing this protocol.Seealso
RSDFormUIStepObject
for an example implementation.Declaration
Swift
public func evaluateCohortsToApply(with result: RSDTaskResult) -> (add: Set<String>, remove: Set<String>)?
Parameters
result
The task result to evaluate.
Return Value
The cohorts to add/remove or
nil
if no rules apply.