---
title: "prepareForTransition(from:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscollectionviewlayout/preparefortransition(from:)"
---

# prepareForTransition(from:)

Prepares the layout object to be installed in the collection view.

## Declaration

```swift
func prepareForTransition(from oldLayout: NSCollectionViewLayout)
```

## Parameters

- `oldLayout`: The layout object installed in the collection view at the beginning of the transition. You might use this object to retrieve the current layout attributes for items and views.

## Discussion

Discussion Prior to transitioning to a new layout object, the collection view calls this method on the new layout object to give it time to perform any initial calculations.

## See Also

### Transitioning Between Layouts

- [prepareForTransition(to:)](appkit/nscollectionviewlayout/preparefortransition(to:).md)
- [finalizeLayoutTransition()](appkit/nscollectionviewlayout/finalizelayouttransition().md)
