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

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -