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.

Delivering Life Cycle Events to Subscribers

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

Sends a completion signal to the subscriber.

Required.

Instance Methods

func send()

Relationships

Inherits From

See Also

Subjects

class AnySubject

A type-erasing subject.

Beta
class CurrentValueSubject

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

Beta
class PassthroughSubject

A subject that passes along values and completion.

Beta

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