Generic Class


A publisher that eventually produces a single value and then finishes or fails.


final class Future<Output, Failure> where Failure : Error


Creating a Future

init((@escaping Future<Output, Failure>.Promise) -> Void)

Creates a publisher that invokes a promise closure when the publisher emits an element.

typealias Future.Promise

A type that represents a closure to invoke in the future, when an element or error is available.

Instance Methods

func max() -> Publishers.Comparison<Future<Output, Failure>>
func min() -> Publishers.Comparison<Future<Output, Failure>>
func switchToLatest() -> Publishers.SwitchToLatest<Output, Future<Output, Failure>>


Conforms To

See Also

Convenience Publishers

struct Just

A publisher that emits an output to each subscriber just once, and then finishes.

struct Deferred

A publisher that awaits subscription before running the supplied closure to create a publisher for the new subscriber.

struct Empty

A publisher that never publishes any values, and optionally finishes immediately.

struct Fail

A publisher that immediately terminates with the specified error.

struct Record

A publisher that allows for recording a series of inputs and a completion, for later playback to each subscriber.


Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software