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.