Last active
August 11, 2020 04:14
-
-
Save serhiybutz/667acb426d2fbfd1cd58656e3134f474 to your computer and use it in GitHub Desktop.
Combine: zip issue, 05
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 events = PassthroughSubject<String, Never>() | |
let numbers = (0...).publisher | |
.print("numbers") | |
let subscriber = events | |
.print("events") | |
.zip(numbers) | |
.map { ($1, $0) } // swap | |
.customSink( | |
initialDemand: .max(5), | |
receiveValue: { value in | |
print(value) | |
}) | |
events.send("foo") | |
events.send("bar") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment