<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionView/moveItem(at:to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UICollectionView(im)moveItemAtIndexPath:toIndexPath:"
  },
  "title" : "moveItem(at:to:)"
}
-->

# moveItem(at:to:)

Moves an item from one location to another in the collection view.

```
func moveItem(at indexPath: IndexPath, to newIndexPath: IndexPath)
```

## Parameters

`indexPath`

The index path of the item you want to move. This parameter must not be `nil`.

`newIndexPath`

The index path of the item’s new location. This parameter must not be `nil`.

## Discussion

Use this method to reorganize existing data items. You might do this when you rearrange the items within your data source object or in response to user interactions with the collection view. You can move items between sections or within the same section. The collection view updates the layout as needed to account for the move, animating cells into position as needed.

You can also call this method from a block passed to the [`performBatchUpdates(_:completion:)`](/documentation/UIKit/UICollectionView/performBatchUpdates(_:completion:)) method when you want to animate multiple separate changes into place at the same time. See the description of that method for more information.

---

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)