From 2afa67daf1b698ea2343e89ddfadcf6c72511021 Mon Sep 17 00:00:00 2001 From: Steven Francony Date: Tue, 10 Nov 2020 11:46:44 +0100 Subject: [PATCH] :bug: Fix issue when call invalidateLayout() Fixed an error that could appear when updating the list when cells are added or removed. This error is : ``` [CollectionView] Layout attributes index path: ( {length = 2, path = 0 - 3}); frame = (0 603; 414 275); zIndex = 3; were received from the layout but are not valid for the data source counts. Attributes will be ignored. ``` --- Sources/CollectionViewSlantedLayout.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/CollectionViewSlantedLayout.swift b/Sources/CollectionViewSlantedLayout.swift index 3796518..a8da570 100644 --- a/Sources/CollectionViewSlantedLayout.swift +++ b/Sources/CollectionViewSlantedLayout.swift @@ -289,5 +289,11 @@ extension CollectionViewSlantedLayout { override open func layoutAttributesForItem(at indexPath: IndexPath) -> CollectionViewSlantedLayoutAttributes? { return cachedAttributes[indexPath.item] } + + /// :nodoc: + override open func invalidateLayout() { + super.invalidateLayout() + self.cachedAttributes.removeAll() + } }