Skip to content

Commit

Permalink
[Issue Xcode-Snippets#32] Adding NSFetchedResultsController snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
mattt committed Nov 21, 2013
1 parent 57c67a8 commit c8ac69e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions frc.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// NSFetchedResultsController
// Boilerplate for creating an NSFetchedResultsController
//
// Platform: iOS
// Language: Objective-C
// Completion Scope: Function or Method

NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:<#(NSString *)#>];
fetchRequest.predicate = [NSPredicate predicateWithFormat:<#(NSString *), ...#>];
fetchRequest.sortDescriptors = @[<#(NSSortDescriptor *), ...#>];

NSFetchedResultsController *fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:<#(NSFetchRequest *)#> managedObjectContext:<#(NSManagedObjectContext *)#> sectionNameKeyPath:<#(NSString *)#> cacheName:<#(NSString *)#>];
fetchedResultsController.delegate = <#(id <NSFetchedResultsControllerDelegate>)#>;

NSError *error = nil;
if (![fetchedResultsController performFetch:&error]) {
NSLog(@"Error: %@", error);
}

0 comments on commit c8ac69e

Please sign in to comment.