RxSwift中的 Disposed by bag的含义

Dispose bags 类似于RX中的ARC的行为。当DisposeBag被释放时,它将在每个添加的一次性用品上调用dispose并释放内存。

它用于处理在闭包中传递的旧引用和不再需要的资源(显然不使用它们):例如,一个HTTP连接,数据库连接或缓存。

Dispose bags are used to return ARC like behavior to RX. When a DisposeBag is deallocated, it will call dispose on each of the added disposables.

It is used to dispose of old references that you pass in the closure and resources that are not needed anymore(and which were apparently not used): for example an open HTTP connection, a database connection or a cache.

你可能感兴趣的:(Swift)