8

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?

Luke
  • 7,110
  • 6
  • 45
  • 74

1 Answers1

3

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 SignalProducers 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.)

Luke
  • 7,110
  • 6
  • 45
  • 74