Pergunta

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?

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top