Protocol

Subject

A publisher that exposes a method for outside callers to publish elements.

Declaration

protocol Subject : AnyObject, Publisher

Overview

A subject is a publisher that you can use to ”inject” values into a stream, by calling its send(_:) method. This can be useful for adapting existing imperative code to the Combine model.

Topics

Delivering Elements to Subscribers

func send(Self.Output)

Sends a value to the subscriber.

Required.

func send()

Sends a void value to the subscriber.

Delivering Life Cycle Events to Subscribers

func send(subscription: Subscription)

Sends a subscription to the subscriber.

Required.

func send(completion: Subscribers.Completion<Self.Failure>)

Sends a completion signal to the subscriber.

Required.

Relationships

Inherits From

See Also

Subjects

class CurrentValueSubject

A subject that wraps a single value and publishes a new element whenever the value changes.

class PassthroughSubject

A subject that broadcasts elements to downstream subscribers.