Fixes `README.md` examples.

This commit is contained in:
Krunoslav Zaher 2016-03-05 19:37:57 +01:00
parent c24df15131
commit a7508fb3a7
1 changed files with 3 additions and 1 deletions

View File

@ -46,7 +46,9 @@ let b /*: Observable<Int>*/ = Variable(2) // b = 2
// if a + b >= 0 {
// c = "\(a + b) is positive"
// }
let c = Observable.combineLatest(a, b) { $0 + $1 } // combines latest values of variables `a` and `b` using `+`
// combines latest values of variables `a` and `b` using `+`
let c = Observable.combineLatest(a.asObservable(), b.asObservable()) { $0 + $1 }
.filter { $0 >= 0 } // if `a + b >= 0` is true, `a + b` is passed to map operator
.map { "\($0) is positive" } // maps `a + b` to "\(a + b) is positive"