Extensions on
Future
Methods
value(_:)
static func value(_ value: Output) -> Future<Output, Failure>
This method immediately resolves with .success(value)
error(_:)
static func error(_ error: Failure) -> Future<Output, Failure>
This method immediately resolves with .failure(error)
mapToFuture(transform:)
func mapToFuture<T>(transform: @escaping (Output) -> T) -> Future<T, Failure>
Apply a transform to a completed Future
, returning another Future
Parameters
Name | Type | Description |
---|---|---|
transform | @escaping (Output) -> T |
A closure accepting |
Returns
Future<T, Failure>
mapToFuture(on:transform:)
func mapToFuture<T, S: Scheduler>(on scheduler: S, transform: @escaping (Output) -> T) -> Future<T, Failure>
Apply a transform to a completed Future
, returning another Future
Parameters
Name | Type | Description |
---|---|---|
scheduler | S |
|
transform | @escaping (Output) -> T |
A closure accepting |
Returns
Future<T, Failure>