How do I convert a RACSignal to a SignalProducer in ReactiveCocoa 5?
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.)
上一篇: 查找包含特定文本的窗口
