Clean internal NSArray copying

Summary:
Fixed #384

- [x] All tests pass. Demo project builds and runs.
Closes https://github.com/Instagram/IGListKit/pull/441

Differential Revision: D4448500

Pulled By: rnystrom

fbshipit-source-id: 38276083a3689eea92c1c7afd1bded3c8fe96282
This commit is contained in:
Bofei Zhu 2017-01-22 14:29:59 -08:00 committed by Facebook Github Bot
parent 955aff1c70
commit d0ff14c934
4 changed files with 10 additions and 10 deletions

View file

@ -373,7 +373,7 @@
- (NSArray *)objects {
IGAssertMainThread();
return [self.sectionMap.objects copy];
return self.sectionMap.objects;
}
- (id<IGListSupplementaryViewSource>)supplementaryViewSourceAtIndexPath:(NSIndexPath *)indexPath {
@ -492,7 +492,7 @@
// clear the view controller and collection context
IGListSectionControllerPopThread();
[map updateWithObjects:objects sectionControllers:[sectionControllers copy]];
[map updateWithObjects:objects sectionControllers:sectionControllers];
// now that the maps have been created and contexts are assigned, we consider the section controller "fully loaded"
for (id object in updatedObjects) {
@ -555,7 +555,7 @@
[indexPaths addObject:[NSIndexPath indexPathForItem:idx inSection:section]];
}];
}
return [indexPaths copy];
return indexPaths;
}
- (NSIndexPath *)indexPathForSectionController:(IGListSectionController *)controller index:(NSInteger)index {
@ -584,7 +584,7 @@
}
}
return [attributes copy];
return attributes;
}
- (void)mapCell:(UICollectionViewCell *)cell toSectionController:(IGListSectionController<IGListSectionType> *)sectionController {
@ -784,7 +784,7 @@
[cells addObject:cell];
}
}
return [cells copy];
return cells;
}
- (void)deselectItemAtIndex:(NSInteger)index

View file

@ -105,7 +105,7 @@ static NSArray *objectsWithDuplicateIdentifiersRemoved(NSArray<id<IGListDiffable
IGLKLog(@"WARNING: Object %@ already appeared in objects array", object);
}
}
return [uniqueObjects copy];
return uniqueObjects;
}
- (void)performBatchUpdatesWithCollectionView:(UICollectionView *)collectionView {
@ -274,8 +274,8 @@ void convertReloadToDeleteInsert(NSMutableIndexSet *reloads,
// reloadSections: is unsafe to use within performBatchUpdates:, so instead convert all reloads into deletes+inserts
convertReloadToDeleteInsert(reloads, deletes, inserts, diffResult, fromObjects);
IGListBatchUpdateData *updateData = [[IGListBatchUpdateData alloc] initWithInsertSections:[inserts copy]
deleteSections:[deletes copy]
IGListBatchUpdateData *updateData = [[IGListBatchUpdateData alloc] initWithInsertSections:inserts
deleteSections:deletes
moveSections:moves
insertIndexPaths:insertIndexPaths
deleteIndexPaths:deleteIndexPaths

View file

@ -314,7 +314,7 @@
x += size.width + self.minimumInteritemSpacing;
idx++;
}
return [array copy];
return array;
}
#pragma mark - Private API

View file

@ -184,7 +184,7 @@ static void * kStackedSectionControllerIndexKey = &kStackedSectionControllerInde
[cells addObject:cell];
}
}
return [cells copy];
return cells;
}
- (void)deselectItemAtIndex:(NSInteger)index sectionController:(IGListSectionController<IGListSectionType> *)sectionController animated:(BOOL)animated {