Generic Instance Method

multicast(subject:)

Provides a subject to deliver elements to multiple subscribers.

Declaration

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

Parameters

subject

A subject to deliver elements to downstream subscribers.

Discussion

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.