Created
June 2, 2017 09:45
-
-
Save portellaa/f05c152b243d0bac4ee81a04419bd143 to your computer and use it in GitHub Desktop.
SwiftAveiro - ReactiveSwift - Do It Right π
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
func timeToDoItCorrectly() { | |
let generator = TimeBasedFibonacciGenerator() | |
// You have this both, feel free to use the one suits you best π€ | |
// let signal = generator.signal | |
let producer = generator.producer | |
let result = producer | |
.take(first: N) | |
.filter { $0 % 2 != 0 } | |
.reduce(0, +) | |
.first() | |
print(result ?? "π£") | |
assert(result?.value == 1089154, "Final result is wrong...") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment