Skip to content

Instantly share code, notes, and snippets.

@ramunasjurgilas
Created January 30, 2020 08:13
Show Gist options
  • Save ramunasjurgilas/1beb2e740c339d2dd2e32d42a9bedc0c to your computer and use it in GitHub Desktop.
Save ramunasjurgilas/1beb2e740c339d2dd2e32d42a9bedc0c to your computer and use it in GitHub Desktop.
collect() as transforming operator
["L", "I", "E", "T", "U", "S", "!"]
.publisher.collect().sink {
print($0)
}
// Output: ["L", "I", "E", "T", "U", "S", "!"]
["L", "I", "E", "T", "U", "S", "!"]
.publisher.collect(4).sink {
print($0)
}
// Output:
// ["L", "I", "E", "T"]
// ["U", "S", "!"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment