RSDTaskObject

public class RSDTaskObject : RSDUIActionHandlerObject, RSDTask, Decodable

RSDTaskObject is the interface for running a task. It includes information about how to calculate progress, validation, and the order of display for the steps.

  • A short string that uniquely identifies the task.

    Declaration

    Swift

    public let identifier: String
  • Information about the task.

    Declaration

    Swift

    public var taskInfo: RSDTaskInfoStep?
  • Information about the result schema.

    Declaration

    Swift

    public var schemaInfo: RSDSchemaInfo?
  • The step navigator for this task.

    Declaration

    Swift

    public let stepNavigator: RSDStepNavigator
  • A list of asynchronous actions to run on the task.

    Declaration

    Swift

    public let asyncActions: [RSDAsyncActionConfiguration]?
  • Default initializer.

    Declaration

    Swift

    public init(taskInfo: RSDTaskInfoStep, stepNavigator: RSDStepNavigator, schemaInfo: RSDSchemaInfo? = nil, asyncActions: [RSDAsyncActionConfiguration]? = nil)

    Parameters

    taskInfo

    Additional information about the task.

    stepNavigator

    The step navigator for this task.

    schemaInfo

    Information about the result schema.

    asyncActions

    A list of asynchronous actions to run on the task.

  • Initialize from a Decoder.

  • example:

       let json = """
           {
           "identifier" : "foo",
           "schemaInfo" : {
                           "identifier" : "foo.1.2",
                           "revision" : 3 },
               "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 if there is a decoding error.

    Declaration

    Swift

    public required init(from decoder: Decoder) throws

    Parameters

    decoder

    The decoder to use to decode this instance.

  • Instantiate a task result that is appropriate for this task.

    Declaration

    Swift

    public func instantiateTaskResult() -> RSDTaskResult

    Return Value

    A task result for this task.

  • Validate the task to check for any model configuration that should throw an error.

    Throws

    An error appropriate to the failed validation.

    Declaration

    Swift

    public func validate() throws