ProgressablePromise
public class ProgressablePromise<T> : AnyProgressablePromise
A wrapper around PromiseKit’s Promise class that supports progress callbacks.
-
The underlaying promise.
Declaration
Swift
public let promise: Promise<T>
-
Creates a
ProgressablePromise
from the given promise. Progress handlers are not suported when using this initlializer.Declaration
Swift
public convenience init(promise: Promise<T>)
Parameters
promise
The promise to wrap.
-
Creates a new
ProgressablePromise
using the given resolver.The callback is given two parameters: a
Resolver<T>
and aProgressHandler
. The callback is expected to perform a task, while calling the progress handler on a regular basis and finally resolve the promise.Declaration
Swift
public convenience init(_ resolver: (Resolver<T>, @escaping ProgressHandler) throws -> Void)
Parameters
resolver
The callback that perform the expected task.
-
Assign a progress handler to the promise that will be called each time an update to the progress is made.
Declaration
Swift
public func progress(_ handler: @escaping (Progress) -> Void) -> Promise<T>