TaskManager
public class TaskManager
A task manager can be given an arbitrary number of Task
s and initialized with a set of Interceptor
s
and Reactor
s, after which it will take care of asynchonous task management for you.
-
Shared TaskManager that is default constructed and has no
Interceptor
s orReactor
s.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
interceptors
an array of interceptors that will be applied to every task before being started
reactors
an 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
Handle
that is returned. Additionally, you can also set an interval on when to start the task but that is only valid ifstartImmediately
is set to trueDeclaration
Parameters
task
the task to run
startImmediately
set this to false if you want to explicity call start on the
Handle
that’s returnedafter
set this to some value if you want the task to start running after some interval
timeout
after how long the task times out (overrides
Task.timeout
)completeOn
specifies which queue completion is called on
completion
called after the task is done with the result of
Task.execute
-
Blocks until all tasks finish executing
Declaration
Swift
public func waitTillAllTasksFinished()