Skip to content

Instantly share code, notes, and snippets.

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
.sink(receiveCompletion: { print($0) }, receiveValue: { print($0) })
// Outputs:
// ```
// (1, 2)
// finished
// ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment