A protocol representing the connection of a subscriber to a publisher.


protocol Subscription


Subscriptions are class constrained because a Subscription has identity, defined by the moment in time a particular subscriber attached to a publisher. Canceling a Subscription must be thread-safe.

You can only cancel a Subscription once.

Canceling a subscription frees up any resources previously allocated by attaching the Subscriber.


Requesting Elements

func request(Subscribers.Demand)

Tells a publisher that it may send more values to the subscriber.


struct Subscribers.Demand

A requested number of items, sent to a publisher from a subscriber through the subscription.

See Also


Processing Published Elements with Subscribers

Apply back pressure to precisely control when publishers produce elements.

protocol Subscriber

A protocol that declares a type that can receive input from a publisher.

enum Subscribers

A namespace for types that serve as subscribers.

struct AnySubscriber

A type-erasing subscriber.

enum Subscriptions

A namespace for symbols related to subscriptions.