CombineErgonomics Documentation

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)

map​ToFuture(transform:​)

func mapToFuture<T>(transform: @escaping (Output) -> T) -> Future<T, Failure>  

Apply a transform to a completed Future, returning another Future

Parameters

transform @escaping (Output) -> T

A closure accepting Output and returning T. This runs on DispatchQueue.global()

Returns

Future<T, Failure>

map​ToFuture(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

scheduler S

DispatchQueue or other Scheduler on which the publisher executes

transform @escaping (Output) -> T

A closure accepting Output and returning T. This runs on scheduler

Returns

Future<T, Failure>