Skip to content

Latest commit

 

History

History
93 lines (71 loc) · 1.6 KB

README.md

File metadata and controls

93 lines (71 loc) · 1.6 KB

AutoDisposable

Usage

First off all, import AutoDisposable and inherit your object via AutoDispose or AutoDisposableController

class YourClass: AutoDispose {
    ...
}

There are two ways to adding your disposables to bag:

1) Using a setAutoDispose method

Driver:
  loading
      .drive(onNext: { _ in
         ...   
      })
      .setAutoDispose(self)
Observable:
  loading
      .bind(onNext: { _ in
         ...   
      })
      .setAutoDispose(self)
      
  loading
      .subscribe(onNext: { _ in
         ...   
      })
      .setAutoDispose(self)
Completable:
  loading
      .subscribe(onCompleted: { _ in
         ...   
      })
      .setAutoDispose(self)

2) Using setAutoDispose method

Driver:
  loading
      .driveWithAutoDispose(self, onNext: { _ in
            ...
       })
Observable:
  loading
      .bindWithAutoDispose(self, onNext: { _ in
            ...
       })
       
  loading
      .subscribeWithAutoDispose(self, onNext: { _ in
         ...   
      })
Completable:
  loading
      .subscribeWithAutoDispose(self, onCompleted: { _ in
            ...
       })

Use the following entry in your Podfile:

pod 'AutoDisposable', :git => 'https://github.com/BiohazardUA/AutoDisposable.git', :tag => '1.0.3'

License

Distributed under the MIT license. [See LICENSE](Distributed under the MIT license. See LICENSE for details.) for details.