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?
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.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.