ReactiveX.io documentation używa używa AnonymousDisposable
, który był w RxSwift 2.x, ale jest nierozwiązanym identyfikatorem w RxSwift 3.0. Co powinienem zamiast tego użyć?Co to jest odpowiednik RxSwift 3.0 dla AnonymousDisposable z 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)
}