Skip to content

Instantly share code, notes, and snippets.

@ramunasjurgilas
Created January 30, 2020 13:31
Show Gist options
  • Save ramunasjurgilas/3ee59640f9674c0e8f978ce21f072a27 to your computer and use it in GitHub Desktop.
Save ramunasjurgilas/3ee59640f9674c0e8f978ce21f072a27 to your computer and use it in GitHub Desktop.
compactMap() as filtering operator
["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