Generic Instance Method


Combines elements from three other publishers and delivers a transformed output.


func zip<P, Q, R, T>(_ publisher1: P, _ publisher2: Q, _ publisher3: R, _ transform: @escaping (Upstream.Output, P.Output, Q.Output, R.Output) -> T) -> Publishers.Map<Publishers.Zip4<Publishers.Breakpoint<Upstream>, P, Q, R>, T> where P : Publisher, Q : Publisher, R : Publisher, Self.Failure == P.Failure, P.Failure == Q.Failure, Q.Failure == R.Failure



A second publisher.


A third publisher.


A fourth publisher.


A closure that receives the most recent value from each publisher and returns a new value to publish.

Return Value

A publisher that uses the transform closure to emit new elements, produced by combining the most recent value from four upstream publishers.


The returned publisher waits until all four publishers have emitted an event, then delivers the oldest unconsumed event from each publisher as a tuple to the closure. For example, if publisher P1 emits elements a and b, and publisher P2 emits elements c and d, and publisher P3 emits the elements e and f, and publisher P4 emits the event g, the transform closure receives the tuple (a, c, e, g). The closure won’t receive a tuple with elements b, d, or f until P4 emits another event. If any upstream publisher finishes successfully or fails with an error, the zipped publisher does the same.