<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionViewLayoutInvalidationContext",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UICollectionViewLayoutInvalidationContext"
  },
  "title" : "UICollectionViewLayoutInvalidationContext"
}
-->

# UICollectionViewLayoutInvalidationContext

A context object that declares which parts of your layout need to be updated when the layout is invalidated.

```
@MainActor class UICollectionViewLayoutInvalidationContext
```

## Overview

Layout objects that are designed to support invalidation contexts can use the information in a [`UICollectionViewLayoutInvalidationContext`](/documentation/UIKit/UICollectionViewLayoutInvalidationContext) object to optimize their behavior during the invalidation cycle. You can create an invalidation context object as a precursor to invalidating a layout object. After configuring the invalidation context object, pass it to the layout object’s [`invalidateLayout(with:)`](/documentation/UIKit/UICollectionViewLayout/invalidateLayout(with:)) method, which is responsible for using the context object to update the layout efficiently. The collection view also creates invalidation contexts in response to specific changes. For example, it creates an invalidation context when you change the layout or data source object, when you insert or delete items, and when you call the [`reloadData()`](/documentation/UIKit/UICollectionView/reloadData()) method.

### Subclassing Notes

If you create your own custom layout objects, you can subclass `UICollectionViewLayoutInvalidationContext` and add properties to specify which aspects of your layout data can be invalidated separately. You must then design your layout object to check for these properties and update the layout appropriately.

For more information about how to support custom invalidation contexts in your layout objects, see [`UICollectionViewLayout`](/documentation/UIKit/UICollectionViewLayout).

## Topics

### Invalidating the Collection View Data

[`invalidateEverything`](/documentation/UIKit/UICollectionViewLayoutInvalidationContext/invalidateEverything)

A Boolean that indicates that all layout data should be marked as invalid.

[`invalidateDataSourceCounts`](/documentation/UIKit/UICollectionViewLayoutInvalidationContext/invalidateDataSourceCounts)

A Boolean that indicates whether the layout should ask for new section and item counts.

### Invalidating the Content Area

[`contentOffsetAdjustment`](/documentation/UIKit/UICollectionViewLayoutInvalidationContext/contentOffsetAdjustment)

The delta value to be applied to the collection view’s content offset.

[`contentSizeAdjustment`](/documentation/UIKit/UICollectionViewLayoutInvalidationContext/contentSizeAdjustment)

The delta value to be applied to the collection view’s content size.

### Invalidating Specific Items

[`-  invalidateItemsAtIndexPaths:`](/documentation/UIKit/UICollectionViewLayoutInvalidationContext/invalidateItems(at:))

Adds the cells at the specified index paths to the list of invalid items.

[`-  invalidateSupplementaryElementsOfKind:atIndexPaths:`](/documentation/UIKit/UICollectionViewLayoutInvalidationContext/invalidateSupplementaryElements(ofKind:at:))

Adds the supplementary views at the specified index paths to the list of invalid items.

[`-  invalidateDecorationElementsOfKind:atIndexPaths:`](/documentation/UIKit/UICollectionViewLayoutInvalidationContext/invalidateDecorationElements(ofKind:at:))

Adds the decoration views at the specified index paths to the list of invalid items.

[`invalidatedItemIndexPaths`](/documentation/UIKit/UICollectionViewLayoutInvalidationContext/invalidatedItemIndexPaths)

An array of index paths representing the cells that were invalidated.

[`invalidatedSupplementaryIndexPaths`](/documentation/UIKit/UICollectionViewLayoutInvalidationContext/invalidatedSupplementaryIndexPaths)

A dictionary that identifies the supplementary views that were invalidated.

[`invalidatedDecorationIndexPaths`](/documentation/UIKit/UICollectionViewLayoutInvalidationContext/invalidatedDecorationIndexPaths)

A dictionary that identifies the decoration views that were invalidated.

### Invalidating the Order of Items

[`previousIndexPathsForInteractivelyMovingItems`](/documentation/UIKit/UICollectionViewLayoutInvalidationContext/previousIndexPathsForInteractivelyMovingItems)

An array of index paths representing the previous location of moving items in the collection view.

[`targetIndexPathsForInteractivelyMovingItems`](/documentation/UIKit/UICollectionViewLayoutInvalidationContext/targetIndexPathsForInteractivelyMovingItems)

An array of index paths representing the new location of moving items in the collection view.

[`interactiveMovementTarget`](/documentation/UIKit/UICollectionViewLayoutInvalidationContext/interactiveMovementTarget)

The current point used to determine the placement of moving items.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

### Inherited By

[`UICollectionViewFlowLayoutInvalidationContext`](/documentation/UIKit/UICollectionViewFlowLayoutInvalidationContext)

---

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)