Generic Instance Method


Combines elements from another publisher and delivers a transformed output.


func zip<P, T>(_ other: P, _ transform: @escaping (Upstream.Output, P.Output) -> T) -> Publishers.Map<Publishers.Zip<Publishers.Catch<Upstream, NewPublisher>, P>, T> where P : Publisher, Self.Failure == P.Failure



Another 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 two upstream publishers.


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