<!--
{
  "availability" : [
    "macOS: 10.11.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCollectionViewLayoutInvalidationContext/invalidateDataSourceCounts",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCollectionViewLayoutInvalidationContext(py)invalidateDataSourceCounts"
  },
  "title" : "invalidateDataSourceCounts"
}
-->

# invalidateDataSourceCounts

A Boolean that indicates whether the layout object should ask for new section and item counts.

```
var invalidateDataSourceCounts: Bool { get }
```

## Discussion

The collection view sets this property in response to specific layout invalidation scenarios. For example, the collection view sets the property to <doc://com.apple.documentation/documentation/Swift/true> when you insert or delete items or call the collection view’s [`reloadData()`](/documentation/AppKit/NSCollectionView/reloadData()) method.

When this property is set to <doc://com.apple.documentation/documentation/Swift/true>, the layout object must query the data source for the new number of sections and items. IT should also update its layout based on the updated number of sections and items.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)