ReactiveX.io documentationAnonymousDisposable
का उपयोग करता है, जो RxSwift 2.x में था, लेकिन RxSwift 3.0 में एक अनसुलझा पहचानकर्ता है। इसके बजाय मुझे क्या उपयोग करना चाहिए?RxSwift 3.0 RxSwift 2.x से बेनामी डिस्पोजेबल के बराबर क्या है?
let source = Observable.create { observer in
for i in 1...5 {
observer.on(.Next(i))
}
observer.on(.Completed)
// Note that this is optional. If you require no cleanup you can return
// NopDisposable.instance
return AnonymousDisposable {
print("Disposed")
}
}
source.subscribe {
print($0)
}