Created
January 30, 2020 10:36
-
-
Save ramunasjurgilas/72706178ab618dd60ed3898d3073f6fc to your computer and use it in GitHub Desktop.
replaceNil 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
[1, nil, 3] | |
.publisher | |
.replaceNil(with: -1) | |
.sink { print($0) } | |
// Output: | |
// Optional(1) | |
// Optional(-1) | |
// Optional(3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment