Manually disposing a DisposeBag in RxSwift

robertsan picture robertsan · Aug 16, 2016 · Viewed 8.5k times · Source

I want to cancel a request and one of the ways is to manually remove the disposable bag.

.addDisposableTo(disposeBag)

As I have the disposeBag object, is there a good way to cancel the request other than that I mentioned above?

Answer

Daniel Sumara picture Daniel Sumara · Aug 16, 2016

You have to just change reference to your disposeBag object. Make it nil or assign new object to disposeBag.

All request will be cancelled.