Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to cancel repeated work scheduled with RACScheduler?

I've scheduled a work with - (RACDisposable *)after:(NSDate *)date repeatingEvery:(NSTimeInterval)interval withLeeway:(NSTimeInterval)leeway schedule:(void (^)(void))block;. How to cancel it?

As far as I understood from description I should use RACDisposable* returned from this method. Should I just call - dispose on this object? Should It be configured somehow for cancelation?

Thanks

like image 364
Kostya Bychkov Avatar asked Dec 07 '25 00:12

Kostya Bychkov


1 Answers

No, there's nothing else you need to do.

RACDisposable just represents a cancelable action, or resources to clean up. In the same way that you invoke -dispose to cancel a subscription, you can use it to cancel a recurring scheduled block.

As an aside, the RACScheduler methods are fairly low-level, and having to invoke them directly is usually an indicator of overly imperative code. If you can, try to use existing RACSignal operators to accomplish what you want in a more functional way.

like image 116
Justin Spahr-Summers Avatar answered Dec 11 '25 16:12

Justin Spahr-Summers



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!