Question

I'd like to make a custom RACSignal, but I'd prefer to not have to make a whole class. I just want to specify a block to call when observers subscribe.

In .Net's Rx I would do this:

return Observable.Create(observer => {
    ...
    // send items to observer
    ...
    return subscriptionDisposer;
});

Does ReactiveCocoa have equivalent functionality?

Was it helpful?

Solution

Self-answer: the RACSignal class has a createSignal method that acts like Observable.Create.

(I would have found it right away with autocomplete, but XCode's autocomplete HALF fails in lots of cases where you have half-written code above what you're editing. You get some results but not others. Bleh.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top