Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save portellaa/f05c152b243d0bac4ee81a04419bd143 to your computer and use it in GitHub Desktop.
Save portellaa/f05c152b243d0bac4ee81a04419bd143 to your computer and use it in GitHub Desktop.
SwiftAveiro - ReactiveSwift - Do It Right 😎
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