Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top