Skip to content

Instantly share code, notes, and snippets.

@ramunasjurgilas
Created February 27, 2020 13:52
Show Gist options
  • Save ramunasjurgilas/798a94dd431a5714931a38ae0f83fafa to your computer and use it in GitHub Desktop.
Save ramunasjurgilas/798a94dd431a5714931a38ae0f83fafa to your computer and use it in GitHub Desktop.
Combining operator: merge(with:)
let strings1 = PassthroughSubject<String, Never>()
let strings2 = PassthroughSubject<String, Never>()
strings1
.merge(with: strings2)
.sink { print($0) }
strings2.send("A")
strings1.send("B")
// Output:
// A
// B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment