سؤال

As title, is there any convention for subscribeNext and subscribeCompleted in ReactiveCocoa?

I know that subscribeNext allows you to pass one object but not in subscribeCompleted. But I would like to know more about semantic differences.

For example, if I implement a timer RACSignal, what method should I use (sendNext or sendCompleted)? Or should I call both of them?

Thanks ;-)

هل كانت مفيدة؟

المحلول

The semantics of a signal are that it can send as many values as it wants, but once it completes or errors, no more values are sent.

So if the timer repeats, you want to use -sendNext:. If it never repeats, -sendCompleted would be appropriate.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top