From 95367bb6a45c48ec43e274734a778c7d19e44158 Mon Sep 17 00:00:00 2001 From: Viktor Gardart Date: Thu, 22 Jun 2017 09:21:50 -0700 Subject: [PATCH] replace alloc] init] -> new] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Issue fixed: #822 As rnystrom would've said: Go 💚 Closes https://github.com/Instagram/IGListKit/pull/823 Differential Revision: D5301864 Pulled By: rnystrom fbshipit-source-id: c7a0f62b91712a54ee75ee0d1fe62b8611745e37 --- Source/IGListAdapter.m | 8 ++++---- Source/IGListCollectionViewLayout.mm | 2 +- Source/IGListStackedSectionController.m | 8 ++++---- Source/Internal/IGListDisplayHandler.m | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/IGListAdapter.m b/Source/IGListAdapter.m index a91ba6e8..42e0d3c1 100644 --- a/Source/IGListAdapter.m +++ b/Source/IGListAdapter.m @@ -46,7 +46,7 @@ NSMapTable *table = [[NSMapTable alloc] initWithKeyPointerFunctions:keyFunctions valuePointerFunctions:valueFunctions capacity:0]; _sectionMap = [[IGListSectionMap alloc] initWithMapTable:table]; - _displayHandler = [[IGListDisplayHandler alloc] init]; + _displayHandler = [IGListDisplayHandler new]; _workingRangeHandler = [[IGListWorkingRangeHandler alloc] initWithWorkingRangeSize:workingRangeSize]; _viewSectionControllerMap = [NSMapTable mapTableWithKeyOptions:NSMapTableObjectPointerPersonality | NSMapTableStrongMemory @@ -330,7 +330,7 @@ IGAssertMainThread(); IGParameterAssert(objects); - NSMutableIndexSet *sections = [[NSMutableIndexSet alloc] init]; + NSMutableIndexSet *sections = [NSMutableIndexSet new]; // use the item map based on whether or not we're in an update block IGListSectionMap *map = [self sectionMapUsingPreviousIfInUpdateBlock:YES]; @@ -605,7 +605,7 @@ - (NSArray *)indexPathsFromSectionController:(IGListSectionController *)sectionController indexes:(NSIndexSet *)indexes usePreviousIfInUpdateBlock:(BOOL)usePreviousIfInUpdateBlock { - NSMutableArray *indexPaths = [[NSMutableArray alloc] init]; + NSMutableArray *indexPaths = [NSMutableArray new]; IGListSectionMap *map = [self sectionMapUsingPreviousIfInUpdateBlock:usePreviousIfInUpdateBlock]; const NSInteger section = [map sectionForSectionController:sectionController]; @@ -632,7 +632,7 @@ - (NSArray *)layoutAttributesForIndexPath:(NSIndexPath *)indexPath supplementaryKinds:(NSArray *)supplementaryKinds { UICollectionViewLayout *layout = self.collectionView.collectionViewLayout; - NSMutableArray *attributes = [[NSMutableArray alloc] init]; + NSMutableArray *attributes = [NSMutableArray new]; UICollectionViewLayoutAttributes *cellAttributes = [layout layoutAttributesForItemAtIndexPath:indexPath]; if (cellAttributes) { diff --git a/Source/IGListCollectionViewLayout.mm b/Source/IGListCollectionViewLayout.mm index f70d84d1..57d71433 100644 --- a/Source/IGListCollectionViewLayout.mm +++ b/Source/IGListCollectionViewLayout.mm @@ -300,7 +300,7 @@ static void adjustZIndexForAttributes(UICollectionViewLayoutAttributes *attribut if (_stickyHeaderOriginYAdjustment != stickyHeaderOriginYAdjustment) { _stickyHeaderOriginYAdjustment = stickyHeaderOriginYAdjustment; - IGListCollectionViewLayoutInvalidationContext *invalidationContext = [[IGListCollectionViewLayoutInvalidationContext alloc] init]; + IGListCollectionViewLayoutInvalidationContext *invalidationContext = [IGListCollectionViewLayoutInvalidationContext new]; invalidationContext.ig_invalidateSupplementaryAttributes = YES; [self invalidateLayoutWithContext:invalidationContext]; } diff --git a/Source/IGListStackedSectionController.m b/Source/IGListStackedSectionController.m index bbe4a6df..35880559 100644 --- a/Source/IGListStackedSectionController.m +++ b/Source/IGListStackedSectionController.m @@ -51,7 +51,7 @@ static void * kStackedSectionControllerIndexKey = &kStackedSectionControllerInde sectionController.viewController = self.viewController; } - _visibleSectionControllers = [[NSCountedSet alloc] init]; + _visibleSectionControllers = [NSCountedSet new]; _sectionControllers = [NSOrderedSet orderedSetWithArray:sectionControllers]; self.displayDelegate = self; @@ -65,8 +65,8 @@ static void * kStackedSectionControllerIndexKey = &kStackedSectionControllerInde #pragma mark - Private API - (void)reloadData { - NSMutableArray *sectionControllers = [[NSMutableArray alloc] init]; - NSMutableArray *offsets = [[NSMutableArray alloc] init]; + NSMutableArray *sectionControllers = [NSMutableArray new]; + NSMutableArray *offsets = [NSMutableArray new]; NSInteger numberOfItems = 0; for (IGListSectionController *sectionController in self.sectionControllers) { @@ -111,7 +111,7 @@ static void * kStackedSectionControllerIndexKey = &kStackedSectionControllerInde - (NSIndexSet *)itemIndexesForSectionController:(IGListSectionController *)sectionController indexes:(NSIndexSet *)indexes { const NSInteger offset = [self offsetForSectionController:sectionController]; - NSMutableIndexSet *itemIndexes = [[NSMutableIndexSet alloc] init]; + NSMutableIndexSet *itemIndexes = [NSMutableIndexSet new]; [indexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) { [itemIndexes addIndex:(idx + offset)]; }]; diff --git a/Source/Internal/IGListDisplayHandler.m b/Source/Internal/IGListDisplayHandler.m index 5c69ab6c..5e73e7de 100644 --- a/Source/Internal/IGListDisplayHandler.m +++ b/Source/Internal/IGListDisplayHandler.m @@ -25,7 +25,7 @@ - (instancetype)init { if (self = [super init]) { - _visibleListSections = [[NSCountedSet alloc] init]; + _visibleListSections = [NSCountedSet new]; _visibleViewObjectMap = [[NSMapTable alloc] initWithKeyOptions:NSMapTableStrongMemory valueOptions:NSMapTableStrongMemory capacity:0]; } return self;