TaskManager
public class TaskManager
A task manager can be given an arbitrary number of Tasks and initialized with a set of Interceptors
and Reactors, after which it will take care of asynchonous task management for you.
-
Shared TaskManager that is default constructed and has no
Interceptors orReactors.Declaration
Swift
public static let shared: TaskManager -
List of reactors that this TaskManager was created with
Declaration
Swift
public var reactors: [Reactor] { get } -
List of interceptors that this TaskManager was created with
Declaration
Swift
public var interceptors: [Interceptor] { get } -
Identifies the TaskManager in question. It is an atomically increasing integer, per TaskManager created
Declaration
Swift
public let identifier: Int -
Initializes this manager object.
Declaration
Swift
public init(interceptors: [Interceptor] = [], reactors: [Reactor] = [])Parameters
interceptorsan array of interceptors that will be applied to every task before being started
reactorsan array of reactors that will be applied to every task after it’s executed
-
Add a task to the manager. You may choose to start the task immediately or start it yourself via the
Handlethat is returned. Additionally, you can also set an interval on when to start the task but that is only valid ifstartImmediatelyis set to trueDeclaration
Parameters
taskthe task to run
startImmediatelyset this to false if you want to explicity call start on the
Handlethat’s returnedafterset this to some value if you want the task to start running after some interval
timeoutafter how long the task times out (overrides
Task.timeout)completeOnspecifies which queue completion is called on
completioncalled after the task is done with the result of
Task.execute -
Blocks until all tasks finish executing
Declaration
Swift
public func waitTillAllTasksFinished()
View on GitHub
TaskManager Class Reference