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
:
loading
.drive(onNext: { _ in
...
})
.setAutoDispose(self)
loading
.bind(onNext: { _ in
...
})
.setAutoDispose(self)
loading
.subscribe(onNext: { _ in
...
})
.setAutoDispose(self)
loading
.subscribe(onCompleted: { _ in
...
})
.setAutoDispose(self)
loading
.driveWithAutoDispose(self, onNext: { _ in
...
})
loading
.bindWithAutoDispose(self, onNext: { _ in
...
})
loading
.subscribeWithAutoDispose(self, onNext: { _ in
...
})
loading
.subscribeWithAutoDispose(self, onCompleted: { _ in
...
})
pod 'AutoDisposable', :git => 'https://github.com/BiohazardUA/AutoDisposable.git', :tag => '1.0.3'
Distributed under the MIT license. [See LICENSE](Distributed under the MIT license. See LICENSE for details.) for details.