Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An initial sketch of Publisher.pairwiseWithDuplicatedStart.
import CombineExt
let upstream = (1...2)
.publisher
.share()
let cancellable = upstream
.first()
.flatMap { first in
upstream
.prepend(first, first)
}
.pairwise()
.sink(receiveValue: { print($0) })
// Outputs:
// ```
// (1, 1)
// (1, 1)
// (1, 2)
// ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment