diff --git a/Source/IGListKit/Internal/IGListUpdateTransactionBuilder.m b/Source/IGListKit/Internal/IGListUpdateTransactionBuilder.m index 96e839a1..1fdc2e19 100644 --- a/Source/IGListKit/Internal/IGListUpdateTransactionBuilder.m +++ b/Source/IGListKit/Internal/IGListUpdateTransactionBuilder.m @@ -147,7 +147,7 @@ typedef NS_ENUM (NSInteger, IGListUpdateTransactionBuilderMode) { } switch (self.mode) { - case IGListUpdateTransactionBuilderModeBatchUpdate: { + case IGListUpdateTransactionBuilderModeBatchUpdate: return [[IGListBatchUpdateTransaction alloc] initWithCollectionViewBlock:collectionViewBlock updater:updater delegate:delegate @@ -157,7 +157,6 @@ typedef NS_ENUM (NSInteger, IGListUpdateTransactionBuilderMode) { applySectionDataBlock:self.applySectionDataBlock itemUpdateBlocks:self.itemUpdateBlocks completionBlocks:self.completionBlocks]; - } case IGListUpdateTransactionBuilderModeReload: { IGListReloadUpdateBlock reloadBlock = self.reloadBlock; if (!reloadBlock) { diff --git a/Source/IGListKit/Internal/UICollectionViewLayout+InteractiveReordering.m b/Source/IGListKit/Internal/UICollectionViewLayout+InteractiveReordering.m index 5e3dcf91..4c950b09 100644 --- a/Source/IGListKit/Internal/UICollectionViewLayout+InteractiveReordering.m +++ b/Source/IGListKit/Internal/UICollectionViewLayout+InteractiveReordering.m @@ -70,10 +70,8 @@ static void * kIGListAdapterKey = &kIGListAdapterKey; NSIndexPath *updatedTarget = [self updatedTargetForInteractivelyMovingItem:previousIndexPath toIndexPath:originalTarget adapter:adapter]; - if (updatedTarget) { - return updatedTarget; - } - return originalTarget; + + return updatedTarget ?: originalTarget; } - (nullable NSIndexPath *)updatedTargetForInteractivelyMovingItem:(NSIndexPath *)previousIndexPath @@ -177,12 +175,9 @@ static void * kIGListAdapterKey = &kIGListAdapterKey; } [modifiedContext invalidateItemsAtIndexPaths:invalidatedItemIndexPaths]; - [originalContext.invalidatedSupplementaryIndexPaths enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSArray * _Nonnull obj, BOOL * _Nonnull stop) { - [modifiedContext invalidateSupplementaryElementsOfKind:key atIndexPaths:obj]; - }]; - [originalContext.invalidatedDecorationIndexPaths enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSArray * _Nonnull obj, BOOL * _Nonnull stop) { - [modifiedContext invalidateDecorationElementsOfKind:key atIndexPaths:obj]; - }]; + [self ig_invalidateAccessoryElementsWithSupplementaryIndexPaths:originalContext.invalidatedSupplementaryIndexPaths + decorationIndexPaths:originalContext.invalidatedDecorationIndexPaths + inContext:modifiedContext]; modifiedContext.contentOffsetAdjustment = originalContext.contentOffsetAdjustment; modifiedContext.contentSizeAdjustment = originalContext.contentSizeAdjustment; @@ -192,4 +187,15 @@ static void * kIGListAdapterKey = &kIGListAdapterKey; return originalContext; } +- (void)ig_invalidateAccessoryElementsWithSupplementaryIndexPaths:(NSDictionary *> *)supplementaryIndexPaths + decorationIndexPaths:(NSDictionary *> *)decorationIndexPaths + inContext:(UICollectionViewLayoutInvalidationContext *)context { + [supplementaryIndexPaths enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSArray *obj, BOOL *stop) { + [context invalidateSupplementaryElementsOfKind:key atIndexPaths:obj]; + }]; + [decorationIndexPaths enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSArray *obj, BOOL *stop) { + [context invalidateDecorationElementsOfKind:key atIndexPaths:obj]; + }]; +} + @end diff --git a/Source/IGListKit/Internal/UIScrollView+IGListKit.m b/Source/IGListKit/Internal/UIScrollView+IGListKit.m index fcfac925..a19d68e7 100644 --- a/Source/IGListKit/Internal/UIScrollView+IGListKit.m +++ b/Source/IGListKit/Internal/UIScrollView+IGListKit.m @@ -11,11 +11,11 @@ - (UIEdgeInsets) ig_contentInset { + UIEdgeInsets contentInset = self.contentInset; if (@available(iOS 11.0, tvOS 11.0, *)) { - return self.adjustedContentInset; - } else { - return self.contentInset; + contentInset = self.adjustedContentInset; } + return contentInset; } @end