---
title: "shouldInvalidateLayout(forBoundsChange:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscollectionviewlayout/shouldinvalidatelayout(forboundschange:)"
---

# shouldInvalidateLayout(forBoundsChange:)

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

## Declaration

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

## Parameters

- `newBounds`: The new bounds of the collection view.

## Return Value

Return Value true if a layout should be invalidated or false if the layout is still valid.

## Discussion

Discussion The default implementation of this method returns 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 true from this method, the collection view invalidates the layout using the invalidateLayout(with:) method. The invalidation context passed to that method is created using the invalidationContext(forBoundsChange:) method.

## See Also

### Invalidating the Layout

- [invalidateLayout()](appkit/nscollectionviewlayout/invalidatelayout().md)
- [invalidateLayout(with:)](appkit/nscollectionviewlayout/invalidatelayout(with:).md)
- [invalidationContextClass](appkit/nscollectionviewlayout/invalidationcontextclass.md)
- [shouldInvalidateLayout(forPreferredLayoutAttributes:withOriginalAttributes:)](appkit/nscollectionviewlayout/shouldinvalidatelayout(forpreferredlayoutattributes:withoriginalattributes:).md)
- [invalidationContext(forBoundsChange:)](appkit/nscollectionviewlayout/invalidationcontext(forboundschange:).md)
- [invalidationContext(forPreferredLayoutAttributes:withOriginalAttributes:)](appkit/nscollectionviewlayout/invalidationcontext(forpreferredlayoutattributes:withoriginalattributes:).md)
