Generic Instance Method

subscribe(_:)

Attaches the specified subscriber to this publisher.

Declaration

func subscribe<S>(_ subscriber: S) where S : Subscriber, Self.Failure == S.Failure, Self.Output == S.Input

Parameters

subscriber

The subscriber to attach to this Publisher. After attaching, the subscriber can start to receive values.

Discussion

Always call this function instead of receive(subscriber:). Adopters of Publisher must implement receive(subscriber:). The implementation of subscribe(_:) in this extension calls through to receive(subscriber:).

See Also

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