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(_:) provided by Publisher calls through to receive(subscriber:).

See Also