How to cancel repeated work scheduled with RACScheduler?

reactive-cocoa

Solution

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.

Problem

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

Original source