How to convert Signal to SignalProducer

331 Views Asked by At

Unfortunately some RAC pieces does not offer SignalProducers, but Signals — like Action has a values field which is Signal. But for my logic I need the SignalProducer.

How can I convert Signal to SignalProducer?

toSignalProducer(toRACSignal(x)) does not seem to be a good solution

1

There are 1 best solutions below

0
On

Currently I stopped on this extension:

extension Signal {

    func toSignalProducer() -> SignalProducer<T, E> {
        return SignalProducer { (sink, compositeDisposable) in
            compositeDisposable.addDisposable(self.observe(sink))
        }
    }

}