Reputation: 3196
Unfortunately some RAC pieces does not offer SignalProducer
s, but Signal
s — 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
Upvotes: 2
Views: 326
Reputation: 3196
Currently I stopped on this extension:
extension Signal {
func toSignalProducer() -> SignalProducer<T, E> {
return SignalProducer { (sink, compositeDisposable) in
compositeDisposable.addDisposable(self.observe(sink))
}
}
}
Upvotes: 0