forked from Xcode-Snippets/Objective-C
-
Notifications
You must be signed in to change notification settings - Fork 0
/
frc.m
18 lines (15 loc) · 850 Bytes
/
frc.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
---
title: "NSFetchedResultsController"
summary: "Boilerplate for creating an NSFetchedResultsController"
platform: iOS
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);
}