<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionViewLayout/layoutAttributesForInteractivelyMovingItem(at:withTargetPosition:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UICollectionViewLayout(im)layoutAttributesForInteractivelyMovingItemAtIndexPath:withTargetPosition:"
  },
  "title" : "layoutAttributesForInteractivelyMovingItem(at:withTargetPosition:)"
}
-->

# layoutAttributesForInteractivelyMovingItem(at:withTargetPosition:)

Retrieves the layout attributes of an item when it is being moved interactively by the user.

```
func layoutAttributesForInteractivelyMovingItem(at indexPath: IndexPath, withTargetPosition position: CGPoint) -> UICollectionViewLayoutAttributes
```

## Parameters

`indexPath`

The index path of the item being moved.

`position`

The current position of the item in the collection view’s coordinate system.

## Return Value

The layout attributes of the item while it is at the specified position.

## Discussion

When an item is moving because of user interactivity, the layout object uses this method to retrieve layout attributes to use for the item while it is at the specified position. The default implementation of this method returns a copy of the item’s existing attributes with two changes: the [`center`](/documentation/UIKit/UICollectionViewLayoutAttributes/center) point is set to the value in `position` and the [`zIndex`](/documentation/UIKit/UICollectionViewLayoutAttributes/zIndex) value is set to <doc://com.apple.documentation/documentation/ObjectiveC/NSIntegerMax> so that the item floats above other items in the collection view.

Subclasses can override this method and modify additional layout attributes as needed. If you override this method, call `super` first to retrieve the item’s existing attributes and then make your changes to the returned structure.

---

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)