<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCollectionViewLayout/shouldInvalidateLayout(forBoundsChange:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCollectionViewLayout(im)shouldInvalidateLayoutForBoundsChange:"
  },
  "title" : "shouldInvalidateLayout(forBoundsChange:)"
}
-->

# shouldInvalidateLayout(forBoundsChange:)

Returns a Boolean indicating whether a bounds change triggers a layout update.

```
func shouldInvalidateLayout(forBoundsChange newBounds: NSRect) -> Bool
```

## Parameters

`newBounds`

The new bounds of the collection view.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if a layout should be invalidated or <doc://com.apple.documentation/documentation/Swift/false> if the layout is still valid.

## Discussion

The default implementation of this method returns <doc://com.apple.documentation/documentation/Swift/false>. You can override this method in your custom layout classes and return a different value as needed. Your implementation of the method should determine if the new bounds would cause changes to the layout of other portions of the collection view.

If you return <doc://com.apple.documentation/documentation/Swift/true> from this method, the collection view invalidates the layout using the [`invalidateLayout(with:)`](/documentation/AppKit/NSCollectionViewLayout/invalidateLayout(with:)) method. The invalidation context passed to that method is created using the [`invalidationContext(forBoundsChange:)`](/documentation/AppKit/NSCollectionViewLayout/invalidationContext(forBoundsChange:)) method.

---

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)