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