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

# invalidationContext(forBoundsChange:)

Returns an invalidation context object that defines the portions of the layout that need to be updated.

```
func invalidationContext(forBoundsChange newBounds: NSRect) -> NSCollectionViewLayoutInvalidationContext
```

## Parameters

`newBounds`

The new bounds for the collection view.

## Return Value

An invalidation context that describes the changes to be made. This value is never `nil`.

## Discussion

The default implementation of this method creates an instance of the class returned by the [`invalidationContextClass`](/documentation/AppKit/NSCollectionViewLayout/invalidationContextClass) method and initializes it using its <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/init()> method. Subclasses can override this method and configure additional properties of the invalidation context. In your implementation, you must call `super` first to get the context object; you can then configure that object and return it.

---

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)