Instance Method


Tells your data source object to move the specified item to its new location.


optional func collectionView(_ collectionView: UICollectionView, moveItemAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath)



The collection view notifying you of the move.


The item’s original index path.


The new index path of the item.


You must implement this method to support the reordering of items within the collection view. If you do not implement this method, the collection view ignores any attempts to reorder items.

When interactions with an item end, the collection view calls this method if the position of the item changed. Use this method to update your data structures with the new index path information.

See Also

Reordering Items

func collectionView(UICollectionView, canMoveItemAt: IndexPath) -> Bool

Asks your data source object whether the specified item can be moved to another location in the collection view.