Generic Instance Method


Combine elements from another publisher and deliver pairs of elements as tuples.


func zip<P>(_ other: P) -> Publishers.Zip<Publishers.Concatenate<Prefix, Suffix>, P> where P : Publisher, Self.Failure == P.Failure



Another publisher.

Return Value

A publisher that emits pairs of elements from the upstream publishers as tuples.


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 subscriber. For example, if publisher P1 emits elements a and b, and publisher P2 emits event c, the zip publisher emits the tuple (a, c). It won’t emit a tuple with event b until P2 emits another event. If either upstream publisher finishes successfuly or fails with an error, the zipped publisher does the same.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software