ios - How can I convert "SignalProducer<Bool, NoError>" to "SignalProducer<Bool, NSError>" of ReactiveCocoa 3? -
i tried creating instance of action<anyobject?, bool, nserror>
of reactivecocoa 3.
let action: action<anyobject?, bool, nserror> = action { _ in if self.flag { return self.foosignalproducer // signalproducer<bool, noerror> } else { return self.barsignalproducer // signalproducer<bool, nserror> } }
this code isn't able compile error 'signalproducer<bool, noerror>' not convertible 'signalproducer<bool, nserror>'
.
how can convert signalproducer<bool, noerror>
signalproducer<bool, nserror>
?
you can use maperror
operator. along lines of:
self.foosignalproducer |> maperror { _ in nserror() }
edit:
as justin points out below, promoteerrors
designed case:
self.foosignalproducer |> promoteerrors(nserror)
Comments
Post a Comment