Frage

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?

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top