RSDTaskPath
public final class RSDTaskPath : NSObject, NSCopying
RSDTaskPath
is used to keep track of the current state of a running task.
Seealso
RSDTaskController
-
The completion handler for a fetched task.
Declaration
Swift
public typealias FetchCompletionHandler = (RSDTaskPath, Error?) -> Void
-
Identifier for this path segment
Declaration
Swift
public let identifier: String
-
Identifier for this task that can be mapped back to a notification. This may be the same as the task identifier, or it might be that a task is scheduled multiple times per day, and the app needs to track what the scheduled timing is for the task.
Declaration
Swift
public var scheduleIdentifier: String?
-
/ String identifying the full path for this task.
Declaration
Swift
public var fullPath: String
-
String representing the current order of steps to this point in the task.
Declaration
Swift
public var stepPath: String
-
The task info object used to load the task.
Declaration
Swift
public private(set) var taskInfo: RSDTaskInfoStep?
-
The task that is currently being run.
Declaration
Swift
public private(set) var task: RSDTask?
-
Convenience method for accessing the top-level task path.
Declaration
Swift
public var topLevelTaskPath: RSDTaskPath
-
The result associated with this task.
Declaration
Swift
public var result: RSDTaskResult
-
A listing of step results that were removed from the task result. These results can be accessed by a step view controller to load a result that was previously selected.
Declaration
Swift
public private(set) var previousResults: [RSDResult]?
-
The current step. If
nil
then the task has not been started.Declaration
Swift
public var currentStep: RSDStep?
-
This is a flag that can be used to mark whether or not the task is ready to be saved.
Declaration
Swift
public var isCompleted: Bool = false
-
This is a flag that can be used to mark when a task was exited early.
Declaration
Swift
public var didExitEarly: Bool = false
-
A pointer to a parent path if this is subtask step.
Declaration
Swift
public private(set) var parentPath: RSDTaskPath?
-
A pointer to the path sections visited
Declaration
Swift
public private(set) var childPaths: [String : RSDTaskPath] = [:]
-
File URL for the directory in which to store generated data files. Asyncronous actions with recorders (and potentially steps) can save data to files during the progress of the task. This property specifies where such data should be written.
If no output directory is specified, this property will use lazy initialization to create a directory in the
NSTemporaryDirectory()
with a subpath of thetaskRunUUID
.In general, set this property after instantiating the task view controller and before presenting it in order to override the default location.
Before presenting the view controller, set the
outputDirectory
property to specify a path where files should be written when anORKFileResult
object must be returned for a step.Note
The calling application is responsible for deleting this directory once the files are processed by encrypting them locally. The encrypted files can then be stored for upload to a server or cloud service. These files are not encrypted so depending upon the application, there is a risk of exposing PII data stored in these files.Declaration
Swift
lazy public var outputDirectory: URL! =
-
Is this the first step in the task?
Declaration
Swift
public var isFirstStep: Bool
-
Initialize the task path with a task.
Declaration
Swift
public init(task: RSDTask, parentPath: RSDTaskPath? = nil)
Parameters
task
The task to set for this path segment.
parentPath
A pointer to the parent task path. Default is
nil
. -
Initialize the task path with a task.
Declaration
Swift
public init(taskInfo: RSDTaskInfoStep, parentPath: RSDTaskPath? = nil)
Parameters
taskInfo
The task info to set for this path segment.
parentPath
A pointer to the parent task path. Default is
nil
. -
Fetch the task associated with this path. This method loads the task and sets up the task result once finished.
Declaration
Swift
public func fetchTask(with factory:RSDFactory, completion: @escaping FetchCompletionHandler)
Parameters
factory
The factory to use to decode the task.
completion
The callback handler to call when the task is loaded.
-
Convenience method for encoding a result. This is a work-around for a limitation of the encoder where it cannot encode an object without a Type for the object.
Declaration
Swift
public func encodeResult(to encoder: RSDFactoryEncoder) throws -> Data
Parameters
encoder
The factory top-level encoder.
Return Value
The encoded result.
-
Append the result to the end of the step history, replacing the previous instance with the same identifier and adding the previous instance to the previous results.
Declaration
Swift
public func appendStepHistory(with newResult: RSDResult)
Parameters
newResult
The result to add to the step history.
-
Remove results from the step history from the result with the given identifier to the end of the array. Add these results to the previous results set.
Declaration
Swift
public func removeStepHistory(from stepIdentifier: String)
Parameters
stepIdentifier
The identifier of the result associated with the given step.
-
Append the async results with the given result, replacing the previous instance with the same identifier.
Declaration
Swift
public func appendAsyncResult(with newResult: RSDResult)
Parameters
result
The result to add to the async results.
-
The description of the path.
Declaration
Swift
override public var description: String
-
Implementation for copying a task path.
Declaration
Swift
public func copy(with zone: NSZone? = nil) -> Any