From d0ff14c934ff4c9d81f7a8d0330eb2a9e72e931e Mon Sep 17 00:00:00 2001 From: Bofei Zhu Date: Sun, 22 Jan 2017 14:29:59 -0800 Subject: [PATCH] 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 --- Source/IGListAdapter.m | 10 +++++----- Source/IGListAdapterUpdater.m | 6 +++--- Source/IGListGridCollectionViewLayout.m | 2 +- Source/IGListStackedSectionController.m | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/IGListAdapter.m b/Source/IGListAdapter.m index ad574a8f..d4e03fdc 100644 --- a/Source/IGListAdapter.m +++ b/Source/IGListAdapter.m @@ -373,7 +373,7 @@ - (NSArray *)objects { IGAssertMainThread(); - return [self.sectionMap.objects copy]; + return self.sectionMap.objects; } - (id)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 *)sectionController { @@ -784,7 +784,7 @@ [cells addObject:cell]; } } - return [cells copy]; + return cells; } - (void)deselectItemAtIndex:(NSInteger)index diff --git a/Source/IGListAdapterUpdater.m b/Source/IGListAdapterUpdater.m index 4dd53723..d3b695ca 100644 --- a/Source/IGListAdapterUpdater.m +++ b/Source/IGListAdapterUpdater.m @@ -105,7 +105,7 @@ static NSArray *objectsWithDuplicateIdentifiersRemoved(NSArray *)sectionController animated:(BOOL)animated {