Created
January 16, 2014 23:13
-
-
Save alexshafran/8465336 to your computer and use it in GitHub Desktop.
Fetched Results Controller Helpers
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
@implementation NSFetchedResultsController (Helpers) | |
- (NSInteger)numberOfObjects | |
{ | |
return [[self.sections valueForKeyPath:@"@sum.numberOfObjects"] integerValue]; | |
} | |
- (id)firstObject | |
{ | |
id<NSFetchedResultsSectionInfo> obj = [self.sections firstObject]; | |
return [[obj objects] firstObject]; | |
} | |
- (id)lastObject | |
{ | |
id<NSFetchedResultsSectionInfo> obj = [self.sections lastObject]; | |
return [[obj objects] lastObject]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment