AutoDisposable 1.0.3

AutoDisposable 1.0.3

Vladyslav Ternovskyi维护。



 
依赖
RxSwift~> 5
RxCocoa~> 5
RxRelay~> 5
 

AutoDisposable

使用

首先,导入AutoDisposable并通过AutoDisposeAutoDisposableController继承你的对象

class YourClass: AutoDispose {
    ...
}

将可释放对象添加到bag有两种方式

1) 使用setAutoDispose方法

Driver
  loading
      .drive(onNext: { _ in
         ...   
      })
      .setAutoDispose(self)
Observable
  loading
      .bind(onNext: { _ in
         ...   
      })
      .setAutoDispose(self)
      
  loading
      .subscribe(onNext: { _ in
         ...   
      })
      .setAutoDispose(self)
可完成的
  loading
      .subscribe(onCompleted: { _ in
         ...   
      })
      .setAutoDispose(self)

2) 使用 setAutoDispose 方法

驱动程序
  loading
      .driveWithAutoDispose(self, onNext: { _ in
            ...
       })
可观测对象
  loading
      .bindWithAutoDispose(self, onNext: { _ in
            ...
       })
       
  loading
      .subscribeWithAutoDispose(self, onNext: { _ in
         ...   
      })
可完成的
  loading
      .subscribeWithAutoDispose(self, onCompleted: { _ in
            ...
       })

在您的 Podfile 中使用以下条目

pod 'AutoDisposable'

许可协议

遵照 MIT 许可协议分发。[查看 LICENSE](Distributed under the MIT license. 查看 LICENSE 以获取详细信息。)。