RSDSectionStepObject
public struct RSDSectionStepObject : RSDSectionStep, RSDConditionalStepNavigator, RSDStepValidator, RSDCopyStep, Decodable
RSDSectionStepObject
is used to define a logical subgrouping of steps such as a section in a longer survey or an active
step that includes an instruction step, countdown step, and activity step.
-
A short string that uniquely identifies the step within the task. The identifier is reproduced in the results of a step history.
Declaration
Swift
public let identifier: String
-
The type of the step.
Declaration
Swift
public let stepType: RSDStepType
-
A list of the steps used to define this subgrouping of steps.
Declaration
Swift
public let steps: [RSDStep]
-
A list of step markers to use for calculating progress.
Declaration
Swift
public var progressMarkers: [String]?
-
A list of asynchronous actions to run on the task.
Declaration
Swift
public var asyncActions: [RSDAsyncActionConfiguration]?
-
Copyright is undefined for a task section. Always
nil
.Declaration
Swift
public let copyright: String?
-
Default initializer.
Declaration
Swift
public init(identifier: String, steps: [RSDStep], type: RSDStepType? = nil)
Parameters
identifier
A short string that uniquely identifies the step.
steps
The steps included in this section.
type
The type of the step. Default =
RSDStepType.section
-
Instantiate a step result that is appropriate for this step. The default for this struct is a
RSDTaskResultObject
.Declaration
Swift
public func instantiateStepResult() -> RSDResult
Return Value
A result for this step.
-
Validate the steps in this section. The steps are valid if their identifiers are unique and if each step is valid.
Declaration
Swift
public func validate() throws
-
Copy the step to a new instance with the given identifier, but otherwise, equal.
Declaration
Swift
public func copy(with identifier: String) -> RSDSectionStepObject
Parameters
identifier
The new identifier.
-
Copy this step with replacement values from the given decoder (if any).
Declaration
Swift
public func copy(with identifier: String, decoder: Decoder?) throws -> RSDSectionStepObject
-
Initialize from a
Decoder
. This implementation will query theRSDFactory
attached to the decoder for the appropriate implementation for each step in the array.example:
// Example JSON dictionary that includes two instruction steps. let json = """ { "identifier": "foobar", "type": "section", "steps": [ { "identifier": "step1", "type": "instruction", "title": "Step 1" }, { "identifier": "step2", "type": "instruction", "title": "Step 2" }, ], "asyncActions" : [ { "identifier" : "location", "type" : "location" } ] } """.data(using: .utf8)! // our data in native (JSON) format
Throws
DecodingError
Declaration
Swift
public init(from decoder: Decoder) throws
Parameters
decoder
The decoder to use to decode this instance.
-
Required implementation for
RSDTask
. This method always returnsnil
.Declaration
Swift
public func action(for actionType: RSDUIActionType, on step: RSDStep) -> RSDUIAction?
-
Required implementation for
RSDTask
. This method always returnsnil
.Declaration
Swift
public func shouldHideAction(for actionType: RSDUIActionType, on step: RSDStep) -> Bool?