Skip to content
Browse files

Add the ability to customize the fetched results controller class

  • Loading branch information...
1 parent a9b4869 commit 7cba2f59d5dd2c5ae1fe37ca25d5216763840b6d @soffes soffes committed Apr 25, 2012
Showing with 7 additions and 1 deletion.
  1. +1 −0 SSManagedViewController.h
  2. +6 −1 SSManagedViewController.m
View
1 SSManagedViewController.h
@@ -17,6 +17,7 @@
@property (nonatomic, strong) SSManagedObject *managedObject;
@property (nonatomic, strong) NSFetchedResultsController *fetchedResultsController;
++ (Class)fetchedResultsControllerClass;
- (NSFetchRequest *)fetchRequest;
- (Class)entityClass;
- (NSArray *)sortDescriptors;
View
7 SSManagedViewController.m
@@ -18,7 +18,7 @@ @implementation SSManagedViewController
- (NSFetchedResultsController *)fetchedResultsController {
if (!_fetchedResultsController) {
- _fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:self.fetchRequest
+ _fetchedResultsController = [[[[self class] fetchedResultsControllerClass] alloc] initWithFetchRequest:self.fetchRequest
managedObjectContext:self.managedObjectContext
sectionNameKeyPath:self.sectionNameKeyPath
cacheName:self.cacheName];
@@ -44,6 +44,11 @@ - (void)dealloc {
#pragma mark - Configuration
++ (Class)fetchedResultsControllerClass {
+ return [NSFetchedResultsController class];
+}
+
+
- (NSFetchRequest *)fetchRequest {
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
fetchRequest.entity = [self.entityClass entityWithContext:self.managedObjectContext];

0 comments on commit 7cba2f5

Please sign in to comment.
Something went wrong with that request. Please try again.