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

# prepare(forCollectionViewUpdates:)

Performs needed tasks before items are inserted, deleted, or moved within the collection view.

```
func prepare(forCollectionViewUpdates updateItems: [NSCollectionViewUpdateItem])
```

## Parameters

`updateItems`

An array of [`NSCollectionViewUpdateItem`](/documentation/AppKit/NSCollectionViewUpdateItem) objects that identify the changes being made.

## Discussion

When items are inserted, deleted, or moved, the collection view calls this method to report those changes to the layout object. The default implementation uses the provided information to plan the layout animations needed to respond to the changes. Subclasses can override this method and use it to prepare for any custom changes, but you should always call `super` at some point in your implementation.

---

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)