문제

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