Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Observable.from(fahrenheit)
.map({ (degreesFahrenheit) -> Double in
return (degreesFahrenheit - 32.0) / 1.8
})
.filter({ (degreesCelsius) -> Bool in
return degreesCelsius <= 20.0
})
.reduce(0.0, accumulator: ({ (result, degreesCelsius) -> Double in
return result + degreesCelsius
}))
.subscribe(onNext: { sum in
print(sum)
})
.disposed(by: disposeBag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.