Skip to content

Instantly share code, notes, and snippets.

@ramunasjurgilas
Last active February 27, 2020 06:30
Show Gist options
  • Save ramunasjurgilas/aea0e3b4ee359d4af2f9aaf5d0e42f12 to your computer and use it in GitHub Desktop.
Save ramunasjurgilas/aea0e3b4ee359d4af2f9aaf5d0e42f12 to your computer and use it in GitHub Desktop.
ignoreOutput() as filtering operator
(1...2000)
.publisher
.ignoreOutput()
.sink(receiveCompletion: { print($0) }, receiveValue: { print($0) })
// Output:
finished
// Without ignoreOutput
(1...3)
.publisher
.sink(receiveCompletion: { print($0) }, receiveValue: { print($0) })
// Output:
// 1
// 2
// 3
// finished
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment