Created
May 15, 2014 11:32
-
-
Save elfenlaid/bf2b27bc08447adf0133 to your computer and use it in GitHub Desktop.
Operation example
This file contains hidden or 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
@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