Create a gist now

Instantly share code, notes, and snippets.

ReactiveCocoa: How to initialize a RACScheduler with a serially executing GCD queue.
@interface SerialScheduler ()
@property (nonatomic, strong) RACScheduler *serialScheduler;
@implementation SerialScheduler
* This scheduler executes signals one a 1-by-1 basis.
* Use it with ReactiveCocoa when you want to handle signal execution serially.
- (RACScheduler *)serialScheduler
_serialScheduler = [[RACTargetQueueScheduler alloc] initWithName:@"QueueName"
targetQueue:dispatch_queue_create("QueueName", DISPATCH_QUEUE_SERIAL)];
return _serialScheduler;


    return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
        return [self.serialScheduler schedule:^{
            // do something
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment