Generic Instance Method


Provides a subject to deliver elements to multiple subscribers.


func multicast<S>(subject: S) -> Publishers.Multicast<Self, S> where S : Subject, Self.Failure == S.Failure, Self.Output == S.Output



A subject to deliver elements to downstream subscribers.


Use a multicast publisher when you have multiple downstream subscribers, but you want upstream publishers to only process one receive(_:) call per event.

In contrast with multicast(_:), this method produces a publisher that shares the provided Subject among all the downstream subscribers.

See Also

Working with Multiple Subscribers

func multicast<S>(() -> S) -> Publishers.Multicast<Self, S>

Applies a closure to create a subject that delivers elements to subscribers.

func share() -> Publishers.Share<Self>

Shares the output of an upstream publisher with multiple subscribers.