在 RxSwift 中手动处理 DisposeBag [英] Manually disposing a DisposeBag in RxSwift

查看:76
本文介绍了在 RxSwift 中手动处理 DisposeBag的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想取消一个请求,其中一种方法是手动取出一次性袋子.

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

.addDisposableTo(disposeBag)

因为我有 disposeBag 对象,所以除了我上面提到的之外,还有什么好的方法可以取消请求吗?

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

推荐答案

您只需更改对 disposeBag 对象的引用.使其为零或将新对象分配给 disposeBag.

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

所有请求都将被取消.

这篇关于在 RxSwift 中手动处理 DisposeBag的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆