flatMapLatestで、最新のストリームだけをflatMap出来る
前の値と流れてくる値にアクセスが出来て
Observable.of(1..<10)
.scan(nil) { preventalue, newValue in
preventValue + neValue
}
.subscribeNext { print("\\($0") }
func combinePrevious(_ initial: Element) -> Observable<(Element, Element)> {
return scan((initial, initial)) { previousValues, newValue in
return (previousValues.1, newValue
}
}
//how to using
observable.of(1..<2)
.combinePrevious(nil)
.subescribeNext { print("\\($0.1 + $0.2))") }