Created
January 30, 2020 11:04
-
-
Save ramunasjurgilas/adbb2166356efd7d44680fa0e9f6b9e9 to your computer and use it in GitHub Desktop.
replaceEmpty as transforming operator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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