Reactive Cocoa 5 and ReactiveSwift network requests handling
I’m trying to figure out if network requests handling can be implemented suitable to my needs using ReactiveSwift and RAC5.
Under topic Migrate from RACSignal to ReactiveSwift or RAC5 I was told it can be done with SignalProducer, but digging deeper into it didn’t give me expected results
So, I would want to have:
Here is what I have
And here is producer initializer
Few problems/questions here:
My personal needs are:
P.S.: Of course, thanks to everyone who read this huge post and spent time helping me!
The “Making network requests” example from the ReactiveSwift readme is a good example for this type of thing. Rather than using
As for managing lifetime, it’s hard to say what the best thing is without knowing your broader code structure. Typically I would add something like
Error events terminate signals. There’s no need to send a completed event after an error, and observers won’t see it anyway. Basically, complete indicates that the signal terminated successfully while an error indicates that the signal terminated in failure.