In ReactiveCocoa 4, we could convert a RACSignal
into a SignalProducer
using toSignalProducer()
. This method does not exist in ReactiveCocoa 5, so how can we do the same thing?
Use bridgedSignalProducer()
in ReactiveObjCBridge :
someSignal.toSignalProducer()
becomes
bridgedSignalProducer(from: someSignal)
This produces a SignalProducer<Value?, AnyError>
. Unlike RAC 4's startWithNext()
, RAC 5's startWithValues()
is only on SignalProducer
s whose Error
type is NoError
. To get around this, I added a utility function on SignalProducer
that behaves the same way as startWithValues
but works with any Error
type (ignoring any error.)
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.