Skip to content

Instantly share code, notes, and snippets.

@elfenlaid
Created May 15, 2014 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elfenlaid/bf2b27bc08447adf0133 to your computer and use it in GitHub Desktop.
Save elfenlaid/bf2b27bc08447adf0133 to your computer and use it in GitHub Desktop.
Operation example
@interface MyAsyncOperation ()
@property (nonatomic) BOOL isExecuting;
@property (nonatomic) BOOL isFinished;
@end
@implementation MyAsyncOperation
- (void)start {
self.isFinished = NO;
self.isExecuting = YES;
[self loadAsyncStuffWithCompletion:^{
self.isExecuting = NO;
self.isFinished = YES;
}];
}
- (BOOL)isConcurrent {
return YES;
}
- (void)setIsExecuting:(BOOL)isExecuting {
[self willChangeValueForKey:@"isExecuting"];
_isExecuting = isExecuting;
[self didChangeValueForKey:@"isExecuting"];
}
- (void)setIsFinished:(BOOL)isFinished {
[self willChangeValueForKey:@"isFinished"];
_isFinished = isFinished;
[self didChangeValueForKey:@"isFinished"];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment