Skip to content

Instantly share code, notes, and snippets.

@steipete
Created April 6, 2012 19:02
Show Gist options
  • Save steipete/2322095 to your computer and use it in GitHub Desktop.
Save steipete/2322095 to your computer and use it in GitHub Desktop.
- (BOOL)isNetworkActivityIndicatorVisible {
return _activityCount > 0;
}
- (void)incrementActivityCount {
[self willChangeValueForKey:@"activityCount"];
OSAtomicIncrement32((int32_t*)&_activityCount);
[self didChangeValueForKey:@"activityCount"];
}
- (void)decrementActivityCount {
[self willChangeValueForKey:@"activityCount"];
OSAtomicDecrement32((int32_t*)&_activityCount);
[self didChangeValueForKey:@"activityCount"];
}
+ (NSSet *)keyPathsForValuesAffectingIsNetworkActivityIndicatorVisible {
return [NSSet setWithObject:@"activityCount"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment