---
title: "setCollectionViewLayout(_:animated:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uicollectionview/setcollectionviewlayout(_:animated:)"
---

# setCollectionViewLayout(_:animated:)

Changes the collection view’s layout and optionally animates the change.

## Declaration

```swift
func setCollectionViewLayout(_ layout: UICollectionViewLayout, animated: Bool)
```

## Parameters

- `layout`: The new layout object for the collection view.
- `animated`: Specify doc://com.apple.documentation/documentation/Swift/true if you want to animate changes from the current layout to the new layout specified by the layout parameter. Specify doc://com.apple.documentation/documentation/Swift/false to make the change without animations.

## Discussion

Discussion This method makes the layout change without further interaction from the user. If you choose to animate the layout change, the animation timing and parameters are controlled by the collection view.

## See Also

### Changing the layout

- [collectionViewLayout](uikit/uicollectionview/collectionviewlayout.md)
- [setCollectionViewLayout(_:animated:completion:)](uikit/uicollectionview/setcollectionviewlayout(_:animated:completion:).md)
- [startInteractiveTransition(to:completion:)](uikit/uicollectionview/startinteractivetransition(to:completion:).md)
- [finishInteractiveTransition()](uikit/uicollectionview/finishinteractivetransition().md)
- [cancelInteractiveTransition()](uikit/uicollectionview/cancelinteractivetransition().md)
- [UICollectionView.LayoutInteractiveTransitionCompletion](uikit/uicollectionview/layoutinteractivetransitioncompletion.md)
