RSDUIStepObject

RSDUIStepObject is the base class implementation for all UI display steps defined in this framework. Depending upon the available real-estate, more than one ui step may be displayed at a time. For example, on an iPad, you may choose to group a set of questions using a RSDSectionStep.

Seealso

RSDActiveUIStepObject, RSDFormUIStepObject, and RSDThemedUIStep
  • 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. This is used to decode the step using a RSDFactory. It can also be used to customize the UI.

    Declaration

    Swift

    public private(set) var stepType: RSDStepType {
      get
      }
  • The primary text to display for the step in a localized string.

    Declaration

    Swift

    open var title: String?
  • Additional text to display for the step in a localized string.

    The additional text is often displayed in a smaller font below title. If you need to display a long question, it can work well to keep the title short and put the additional content in the text property.

    Declaration

    Swift

    open var text: String?
  • Additional detailed explanation for the step.

    The font size and display of this property will depend upon the device type.

    Declaration

    Swift

    open var detail: String?
  • Additional text to display for the step in a localized string at the bottom of the view.

    The footnote is intended to be displayed in a smaller font at the bottom of the screen. It is intended to be used in order to include disclaimer, copyright, etc. that is important to display in the step but should not distract from the main purpose of the step.

    Declaration

    Swift

    open var footnote: String?
  • The permissions used by this task that are described by this step.

    Declaration

    Swift

    open var standardPermissions: [RSDStandardPermission]?
  • Should this step be displayed if and only if the flag has been set for displaying the full instructions?

    Declaration

    Swift

    open var fullInstructionsOnly: Bool
  • The view info used to create a custom step.

    Declaration

    Swift

    open var viewTheme: RSDViewThemeElement?
  • The color theme.

    Declaration

    Swift

    open var colorMapping: RSDColorMappingThemeElement?
  • The image theme.

    Declaration

    Swift

    open var imageTheme: RSDImageThemeElement?
  • The next step to jump to. This is used where direct navigation is required. For example, to allow the task to display information or a question on an alternate path and then exit the task. In that case, the main branch of navigation will need to jump over the alternate path step and the alternate path step will need to jump to the exit.

    This step is not intended for optional navigation where the result might change the intended navigation. For the case where a user action might result in a different navigation path, you can have the step controller set the step result to a result that implements RSDNavigationResult and then set the skipToIdentifier on that result. RSDResultObject and RSDCollectionResultObject both implement this protocol. The reason for doing this is that each time a step is visited in a a navigation path, the result of that step is replaced with an immutable result and will not use the previous result navigation unless specifically set by the step controller.

    Seealso

    RSDStepViewController.assignSkipToIdentifier()

    Declaration

    Swift

    open private(set) var nextStepIdentifier: String? {
      get
      }
  • The navigation cohort rules to apply before displaying the step.

    Declaration

    Swift

    public var beforeCohortRules: [RSDCohortNavigationRule]?
  • The navigation cohort rules to apply after displaying the step.

    Declaration

    Swift

    public var afterCohortRules: [RSDCohortNavigationRule]?
  • The default step type.

    Declaration

    Swift

    open class func defaultType() -> RSDStepType
  • Default initializer.

    Declaration

    Swift

    public required init(identifier: String, type: RSDStepType? = nil)

    Parameters

    identifier

    A short string that uniquely identifies the step.

    type

    The type of the step. Default = RSDStepType.instruction

  • Initializer for setting the immutable next step identifier.

    Declaration

    Swift

    public init(identifier: String, nextStepIdentifier: String?, type: RSDStepType? = nil)

    Parameters

    identifier

    A short string that uniquely identifies the step.

    nextStepIdentifier

    The next step to jump to. This is used where direct navigation is required.

    type

    The type of the step. Default = RSDStepType.instruction

  • Copy the step to a new instance with the given identifier, but otherwise, equal.

    Declaration

    Swift

    public func copy(with identifier: String) -> Self

    Parameters

    identifier

    The new identifier.

  • Copy the step to a new instance with the given identifier and user info.

    Declaration

    Swift

    public func copy(with identifier: String, decoder: Decoder?) throws -> Self

    Parameters

    identifier

    The new identifier.

    decoder

    A decoder that can be used to decode properties on this step.

  • Swift subclass override for copying properties from the instantiated class of the copy(with:) method. Swift does not nicely handle casting from Self to a class instance for non-final classes. This is a work-around.

    Declaration

    Swift

    open func copyInto(_ copy: RSDUIStepObject)
  • Instantiate a step result that is appropriate for this step. Default implementation will return a RSDResultObject.

    Declaration

    Swift

    open func instantiateStepResult() -> RSDResult

    Return Value

    A result for this step.

  • Required method. The base class implementation does nothing.

    Declaration

    Swift

    open func validate() throws
  • Identifier for the next step to navigate to based on the current task result. By default, if there is a navigation skipToIdentifier for this step, then that will be honored. Otherwise, this will return nextStepIdentifier.

    Declaration

    Swift

    open func nextStepIdentifier(with result: RSDTaskResult?, isPeeking: Bool) -> String?

    Return Value

    The identifier of the next step.

  • Initialize from a Decoder.

    Note

    The imageTheme can be decoded as a RSDFetchableImageThemeElementObject or RSDAnimatedImageThemeElementObject, depending upon the included dictionary.

  • example:

        // Example JSON for a step with an `RSDAnimatedImageThemeElement`.
        let json = """
           {
               "identifier": "foo",
               "type": "instruction",
               "title": "Hello World!",
               "text": "Some text.",
               "detail": "This is a test.",
               "footnote": "This is a footnote.",
               "nextStepIdentifier": "boo",
               "actions": { "goForward": { "type": "default", "buttonTitle" : "Go, Dogs! Go!" },
                            "cancel": { "type": "default", "iconName" : "closeX" }
                           },
               "shouldHideActions": ["goBackward"],
               "image"  : {    "type" : "animated",
                               "imageNames" : ["foo1", "foo2", "foo3", "foo4"],
                               "placementType" : "topBackground",
                               "animationDuration" : 2,
                                  },
               "viewTheme"      : { "viewIdentifier": "ActiveInstruction",
                                    "storyboardIdentifier": "ActiveTaskSteps",
                                    "bundleIdentifier": "org.example.SharedResources" },
               "beforeCohortRules" : { "requiredCohorts" : ["boo", "goo"],
                                       "skipToIdentifier" : "blueGu",
                                       "operator" : "any" },
               "afterCohortRules" : { "requiredCohorts" : ["boo", "goo"],
                                       "skipToIdentifier" : "blueGu",
                                       "operator" : "any" }
           }
           """.data(using: .utf8)! // our data in native (JSON) format
    
        // Example JSON for a step with an `RSDFetchableImageThemeElement`.
        let json = """
           {
               "identifier"   : "goOutside",
               "type"         : "instruction",
               "title"        : "Go outside",
               "image"        : {   "type" : "fetchable",
                                    "imageName": "goOutsideIcon",
                                    "placementType": "topBackground" },
               "colorMapping"   : { "customColor": {"backgroundColor" : "robinsEggBlue", "usesLightStyle" : true }},
               "actions"      : { "goForward": { "type": "default", "buttonTitle": "I am outside" }},
           }
           """.data(using: .utf8)! // our data in native (JSON) format
    
    
  • Throws

    DecodingError

    Declaration

    Swift

    public required init(from decoder: Decoder) throws

    Parameters

    decoder

    The decoder to use to decode this instance.

  • Decode from the given decoder, replacing values on self with those from the decoder if the properties are mutable.

    Declaration

    Swift

    public final func decode(from decoder: Decoder) throws
  • Decode from the given decoder, replacing values on self with those from the decoder if the properties are mutable. This function is designed to loop through a second pass to replace any values that should be decoded for a specific device type.

    Declaration

    Swift

    open func decode(from decoder: Decoder, for deviceType: RSDDeviceType?) throws