Skip to content

Layout attributes were received from the layout but are not valid for the data source counts. Attributes will be ignored. #47

Description

@WestFR

Hello,

First of all, apologize for my level of English language.
I have setup a view collection with a search bar and filters. The layout being made with your package.

When i perform a reload on this with this method : self.collectionView.collectionViewLayout.invalidateLayout().

I obtain this error on the debugger :

[CollectionView] Layout attributes <CollectionViewSlantedLayout.CollectionViewSlantedLayoutAttributes: 0x7ff1035113c0> index path: (<NSIndexPath: 0xbcd26c36f94746f0> {length = 2, path = 0 - 3}); frame = (0 603; 414 275); zIndex = 3;  were received from the layout <CollectionViewSlantedLayout.CollectionViewSlantedLayout: 0x7ff1035148a0> but are not valid for the data source counts. Attributes will be ignored.

After research i solved it by adding this method to your class CollectionViewSlantedLayout.swift

The method to add is :

override open func invalidateLayout() {
    super.invalidateLayout()
    self.cachedAttributes.removeAll()
}

I can put this code and make a pull request if you want and if you are ok.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions