本文介绍了当我们应该在RxSwift中调用addDisposableTo(disposeBag)时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们创建了一个
$ b

如果

 <$ c  $  DisposeBag 会自动释放订阅它的观察者吗? $ c> let disposeBag = DisposeBag()

Observable.just(

We create a DisposeBag, and a Observable, subscribe the Observable and then addDisposableTo(disposeBag), I know when the DisposeBag is going to deinit, it will call dispose() to release resources otherwise it will lead memory leak.

If the Observable send Complete or Error that terminate in finite time. When the Observable terminate before DisposeBag deinit, do I have the need to call addDisposableTo(disposeBag)? Does DisposeBag automatically release the observer that subscribed to it when it received terminated message?

let disposeBag = DisposeBag()Observable.just("                        

这篇关于当我们应该在RxSwift中调用addDisposableTo(disposeBag)时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 18:50