-
-
Save jasdev/88dc714541995b37504615d13856960f to your computer and use it in GitHub Desktop.
An example of Publishers.Zip completing even if only one of the inner publishers completes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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