flatMapLatest
새로운 값이 들어오면, 기존에 진행 중이던 작업을 취소하고 새로운 작업을 시작하는 연산자
1
2
3
4
button.rx.tap
.flatMapLatest { Observable.just("새로운 값 방출") }
.subscribe(onNext: { print($0) })
- 버튼을 클릭 새로운 값 방출 :
button.rx.tap
- 기존의
Observable
취소, 새로운Observable
방출 :Observable.just("새로운 값 방출")
- 새로운
Observable
을 구독하여 출력 :.subscribe(onNext: { print($0) })
This post is licensed under CC BY 4.0 by the author.