Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[Issue #32] Adding NSFetchedResultsController snippet

  • Loading branch information...
commit c8ac69e9464cabeac1531ff4f9d7dfbd26f0a0ff 1 parent 57c67a8
@mattt mattt authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 frc.m
View
18 frc.m
@@ -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);
+}
Please sign in to comment.
Something went wrong with that request. Please try again.