Domanda

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?

È stato utile?

Soluzione

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.)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top