Skip to content

Instantly share code, notes, and snippets.

@rodericj
Created January 8, 2015 02:22
Show Gist options
  • Save rodericj/31431d401f6ef064b475 to your computer and use it in GitHub Desktop.
Save rodericj/31431d401f6ef064b475 to your computer and use it in GitHub Desktop.
/**
* Internal method that sends updates to all of the device's subscribers, allowing them to act on the new information.
* Should be called whenever the device's state has changed or when the device has received an update.
*/
- (void)updateAllSubscribers
{
// Use a copy to avoid mutation while enumerating. This makes it possible to miss an update, so fix that at some
// point.
NSMutableArray * tempCopy = [self.deviceSubscribers copy];
for(id<RACSubscriber> subscriber in tempCopy){
[subscriber sendNext:self];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment