<!--
{
  "availability" : [
    "macOS: 10.11.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCollectionViewElement/willTransition(from:to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSCollectionViewElement(im)willTransitionFromLayout:toLayout:"
  },
  "title" : "willTransition(from:to:)"
}
-->

# willTransition(from:to:)

Tells the element that the layout object of the collection view is about to change.

```
@MainActor optional func willTransition(from oldLayout: NSCollectionViewLayout, to newLayout: NSCollectionViewLayout)
```

## Parameters

`oldLayout`

The current layout object used by the collection view.

`newLayout`

The new layout object that is about to be used by the collection view.

## Discussion

The default implementation of this method does nothing. Subclasses can override it and use it to prepare for the change in layouts.

### Special Considerations

In OS X 10.11, this method is never called.

---

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)