Skip to content

Instantly share code, notes, and snippets.

@ramunasjurgilas
Created January 30, 2020 11:04
Show Gist options
  • Save ramunasjurgilas/adbb2166356efd7d44680fa0e9f6b9e9 to your computer and use it in GitHub Desktop.
Save ramunasjurgilas/adbb2166356efd7d44680fa0e9f6b9e9 to your computer and use it in GitHub Desktop.
replaceEmpty as transforming operator
let empty = Empty<String, Never>()
empty
.replaceEmpty(with: "Replaced")
.sink(
receiveCompletion: { print($0) },
receiveValue: { print($0) }
)
// Output:
// Replaced
// finished
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment