Subscribes to three additional publishers and publishes a tuple upon receiving output from any of the publishers.
SDKs
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
- Xcode 11.0+
Framework
- Combine
Declaration
func combineLatest<P, Q, R>(_ publisher1: P, _ publisher2: Q, _ publisher3: R) -> Publishers.Combine Latest4<Publishers.Try Last Where<Upstream>, P, Q, R> where P : Publisher, Q : Publisher, R : Publisher, Self.Failure == P.Failure, P.Failure == Q.Failure, Q.Failure == R.Failure
Parameters
publisher1
A second publisher to combine with this one.
publisher2
A third publisher to combine with this one.
publisher3
A fourth publisher to combine with this one.
Return Value
A publisher that receives and combines elements from this publisher and three other publishers.
Discussion
The combined publisher passes through any requests to all upstream publishers. However, it still obeys the demand-fulfilling rule of only sending the request amount downstream. If the demand isn’t unlimited
, it drops values from upstream publishers. It implements this by using a buffer size of 1 for each upstream, and holds the most recent value in each buffer. All upstream publishers need to finish for this publisher to finish. If an upstream publisher never publishes a value, this publisher neither produces any elements nor signals that publishing has completed. If any of the combined publishers terminates with a failure, this publisher also fails.