Last active
August 29, 2015 13:58
-
-
Save rizumita/10333688 to your computer and use it in GitHub Desktop.
Using ReactiveCoreData with NSBlockOperation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSBlockOperation *operation = [NSBlockOperation blockOperationWithBlock:^{ | |
[[[RACSignal startEagerlyWithScheduler:[RACScheduler scheduler] block:^(id <RACSubscriber> subscriber) { | |
NSManagedObjectContext *context = [NSManagedObjectContext contextWithMainContext:self.managedObjectContext]; // self is AppDelegate | |
[context attachToCurrentScheduler]; | |
[subscriber sendNext:nil]; | |
[subscriber sendCompleted]; | |
}] saveContext] subscribeCompleted:^{ | |
NSLog(@"Completed"); | |
}]; | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment