RSDTransformerStepObject

public struct RSDTransformerStepObject : RSDTransformerStep, Decodable

RSDTransformerStepObject is used in decoding a step with replacement properties for some or all of the steps in a section that is defined using a different resource. The factory will convert this step into an appropriate RSDSectionStep from the decoded object.

  • 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 steps keyed by identifier with replacement values for the properties in the step.

    Declaration

    Swift

    public var replacementSteps: [RSDGenericStep]?
  • The transformer for the section steps.

    Declaration

    Swift

    public var sectionTransformer: RSDSectionStepTransformer!
  • Initialize from a Decoder.

  • example:

        // Example JSON dictionary that includes a transformation step. The section is created from the
        // resource and then the values in the `replacementSteps` are used to mutate that step.
        let json = """
           {
            "identifier"         : "heartRate.before",
            "type"               : "transform",
            "replacementSteps"   : [{   "identifier"   : "instruction",
                                        "title"        : "This is a replacement title for the instruction.",
                                        "text"         : "This is some replacement text." },
                                    {   "identifier"   : "feedback",
                                        "text"         : "Your pre run heart rate is" }
                                    ],
           "sectionTransformer"    : { "resourceName": "HeartrateStep.json"}
           }
        """.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 method. Returns the default for a section step.

    Declaration

    Swift

    public func instantiateStepResult() -> RSDResult
  • Required method. Does nothing.

    Declaration

    Swift

    public func validate() throws