---
title: "prepare(forCollectionViewUpdates:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uicollectionviewlayout/prepare(forcollectionviewupdates:)"
---

# prepare(forCollectionViewUpdates:)

Notifies the layout object that the contents of the collection view are about to change.

## Declaration

```swift
func prepare(forCollectionViewUpdates updateItems: [UICollectionViewUpdateItem])
```

## Parameters

- `updateItems`: An array of doc://com.apple.uikit/documentation/UIKit/UICollectionViewUpdateItem objects that identify the changes being made.

## Discussion

Discussion When items are inserted or deleted, the collection view notifies its layout object so that it can adjust the layout as needed. The first step in that process is to call this method to let the layout object know what changes to expect. After that, additional calls are made to gather layout information for inserted, deleted, and moved items that are going to be animated around the collection view.

## See Also

### Responding to collection view updates

- [finalizeCollectionViewUpdates()](uikit/uicollectionviewlayout/finalizecollectionviewupdates().md)
- [indexPathsToInsertForSupplementaryView(ofKind:)](uikit/uicollectionviewlayout/indexpathstoinsertforsupplementaryview(ofkind:).md)
- [indexPathsToInsertForDecorationView(ofKind:)](uikit/uicollectionviewlayout/indexpathstoinsertfordecorationview(ofkind:).md)
- [initialLayoutAttributesForAppearingItem(at:)](uikit/uicollectionviewlayout/initiallayoutattributesforappearingitem(at:).md)
- [initialLayoutAttributesForAppearingSupplementaryElement(ofKind:at:)](uikit/uicollectionviewlayout/initiallayoutattributesforappearingsupplementaryelement(ofkind:at:).md)
- [initialLayoutAttributesForAppearingDecorationElement(ofKind:at:)](uikit/uicollectionviewlayout/initiallayoutattributesforappearingdecorationelement(ofkind:at:).md)
- [indexPathsToDeleteForSupplementaryView(ofKind:)](uikit/uicollectionviewlayout/indexpathstodeleteforsupplementaryview(ofkind:).md)
- [indexPathsToDeleteForDecorationView(ofKind:)](uikit/uicollectionviewlayout/indexpathstodeletefordecorationview(ofkind:).md)
- [finalLayoutAttributesForDisappearingItem(at:)](uikit/uicollectionviewlayout/finallayoutattributesfordisappearingitem(at:).md)
- [finalLayoutAttributesForDisappearingSupplementaryElement(ofKind:at:)](uikit/uicollectionviewlayout/finallayoutattributesfordisappearingsupplementaryelement(ofkind:at:).md)
- [finalLayoutAttributesForDisappearingDecorationElement(ofKind:at:)](uikit/uicollectionviewlayout/finallayoutattributesfordisappearingdecorationelement(ofkind:at:).md)
- [targetIndexPath(forInteractivelyMovingItem:withPosition:)](uikit/uicollectionviewlayout/targetindexpath(forinteractivelymovingitem:withposition:).md)
