RSDTaskControllerDelegate

public protocol RSDTaskControllerDelegate : AnyObject, NSObjectProtocol

RSDTaskControllerDelegate is responsible for processing the results of the task, providing some input into how the controller behaves, and providing additional content as needed. It’s primary purpose is to handle processing the results of running the task.

  • Tells the delegate that the task has finished.

    The task controller should call this method when an unrecoverable error occurs, when the user has canceled the task (with or without saving), or when the user completes the last step in the task.

    In most circumstances, the receiver should dismiss the task view controller in response to this method, and may also need to collect and process the results of the task.

    Declaration

    Swift

    func taskController(_ taskController: RSDTaskController, didFinishWith reason: RSDTaskFinishReason, error: Error?)

    Parameters

    taskController

    The RSDTaskController instance that is returning the result.

    reason

    An RSDTaskFinishReason value indicating how the user chose to complete the task.

    error

    If failure occurred, an NSError object indicating the reason for the failure. The value of this parameter is nil if reason does not indicate failure.

  • Tells the delegate that the task is ready to save.

    The task controller should call this method when the task has completed all steps that add information to the result set. This may be called on the last step or prior to the last step if that step is a completion step or else a step used to display the results of a task. This allows the developers to mark the end timestamp for when a task ended rather than for when the participant dismissed the task.

    Declaration

    Swift

    func taskController(_ taskController: RSDTaskController, readyToSave taskViewModel: RSDTaskViewModel)

    Parameters

    taskController

    The RSDTaskController instance that is returning the result.

    taskViewModel

    The task path with the results for this task run.