Created
January 30, 2020 13:31
-
-
Save ramunasjurgilas/3ee59640f9674c0e8f978ce21f072a27 to your computer and use it in GitHub Desktop.
compactMap() as filtering 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", "a", "3.5", "2,5"] | |
.publisher | |
.compactMap { Double($0) } | |
.sink { print($0) } | |
// Output: | |
// 1.0 | |
// 3.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment