Alejandro Martinez

BlogPodcastPortfolio Youtube

28 February, 2018Development🕐 1min read

How flatMapLatest cancels an API request

How flatMapLatest cancels an API request? This is a common question that people has when they start learning about Rx. Specially since RxSwift has an example of this in the README.

My answer: it doesn't.

The fact that you see the API request being cancelled when using flatMapLatest is a side effect (pun intended) of the combination of how Rx works and the specific integration with your networking code.

Specifically flatMapLatest just disposes the Observable, is the networking code that cancels the request when the Disposable is disposed.

👉🏻 If you have any feedback you can reach me at alexito4

Processing and p5 in SwiftTesting an RxSwift operator with TestScheduler

Alejandro Martinez

Buka pintu