Future
public struct Future<T>
A Future
represents a value to be determined later.
Future
provides an interface for manipulating that value.
future
.map { $0 + 1 }
.flatMap { $0.futureComp() }
.onComplete { print($0) }
-
Undocumented
Declaration
Swift
public struct Future<T>
-
Undocumented
Declaration
Swift
public struct Future<T>
-
Undocumented
Declaration
Swift
public struct Future<T>
-
Transform this future value into a different one.
Declaration
Swift
public func map<U>(f: T -> U) -> Future<U>
-
Transform this future value with a future mapping function.
Declaration
Swift
public func apply<U>(futureFunc: Future<T -> U>) -> Future<U>
-
Declaration
Swift
public static func of<T>(t: T) -> Future<T>
Return Value
A completed future of value
t
. -
Transforms this future value into a different future value.
Declaration
Swift
public func flatMap<U>(f: T -> Future<U>) -> Future<U>
-
Add a handler to be called when this future is complete. If this future is alread complete, this handler is called immediately, asynchronously.
Declaration
Swift
public func onComplete(handler: T -> ())