Eliminate unnecessary manual tracking of inserted objects in favor of MOC insertedObjects:

This commit is contained in:
Blake Watters
2012-08-22 18:54:23 -04:00
parent af36e72ac2
commit 5852d7c997
3 changed files with 22 additions and 64 deletions

View File

@@ -19,7 +19,6 @@
@interface RKManagedObjectMappingOperationDataSource ()
@property (nonatomic, retain, readwrite) NSManagedObjectContext *managedObjectContext;
@property (nonatomic, retain, readwrite) id<RKManagedObjectCaching> managedObjectCache;
@property (nonatomic, retain) NSMutableArray *mutableInsertedObjects;
@end
@implementation RKManagedObjectMappingOperationDataSource
@@ -27,8 +26,6 @@
@synthesize managedObjectContext = _managedObjectContext;
@synthesize managedObjectCache = _managedObjectCache;
@synthesize operationQueue = _operationQueue;
@synthesize tracksInsertedObjects = _tracksInsertedObjects;
@synthesize mutableInsertedObjects = _mutableInsertedObjects;
- (id)initWithManagedObjectContext:(NSManagedObjectContext *)managedObjectContext cache:(id<RKManagedObjectCaching>)managedObjectCache
{
@@ -38,8 +35,6 @@
if (self) {
self.managedObjectContext = managedObjectContext;
self.managedObjectCache = managedObjectCache;
self.mutableInsertedObjects = [NSMutableArray array];
self.tracksInsertedObjects = NO;
}
return self;
@@ -50,7 +45,6 @@
[_managedObjectCache release];
[_managedObjectContext release];
[_operationQueue release];
[_mutableInsertedObjects release];
[super dealloc];
}
@@ -124,10 +118,6 @@
if ([self.managedObjectCache respondsToSelector:@selector(didCreateObject:)]) {
[self.managedObjectCache didCreateObject:object];
}
if (self.tracksInsertedObjects) {
[self.mutableInsertedObjects addObject:object];
}
}
return object;
@@ -170,14 +160,4 @@
}
}
- (NSArray *)insertedObjects
{
return [NSArray arrayWithArray:self.mutableInsertedObjects];
}
- (void)clearInsertedObjects
{
self.mutableInsertedObjects = [NSMutableArray array];
}
@end