简体   繁体   中英

How can I convert a RACDisposable to a Disposable in ReactiveCocoa 5?

In ReactiveCocoa 5, how can I convert a RACDisposable to a Disposable ? If I try to add a RACDisposable to a CompositeDisposable , I get "Binary operator '+=' cannot be applied to operands of type 'CompositeDisposable' and 'RACDisposable'".

Use a closure to wrap the Objective-C things.

let disposable = CompositeDisposable()

let racDisposable = RACDisposable()

disposable += {
    racDisposable.dispose()
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM