RSDStepTransformerObject

public struct RSDStepTransformerObject : RSDStepTransformer, Decodable

RSDStepTransformerObject 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.

  • The transformed step.

    Declaration

    Swift

    public let transformedStep: RSDStep!
  • 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",
            "steps"   : [{   "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" }
                                    ],
           "resourceTransformer"    : { "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.