Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An example of Publishers.Zip completing even if only one of the inner publishers completes.
import Combine
let first = PassthroughSubject<Int, Never>()
let second = Just(2)
let cancellable = first
.zip(second)
.sink(receiveCompletion: { print($0) }, receiveValue: { print($0) })
first.send(1)
// Outputs:
// ```
// (1, 2)
// finished
// ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment