collectionView(_:targetIndexPathForMoveFromItemAt:toProposedIndexPath:)
Asks the delegate for the index path to use when moving an item.
Declaration
optional func collectionView(_ collectionView: UICollectionView, targetIndexPathForMoveFromItemAt currentIndexPath: IndexPath, toProposedIndexPath proposedIndexPath: IndexPath) -> IndexPathParameters
- collectionView:
The collection view making the request.
- currentIndexPath:
The item’s original index path.
- proposedIndexPath:
The proposed index path of the item.
Return Value
The index path you want to use for the item. If you do not implement this method, the collection view uses the index path in the proposedIndexPath parameter.
Discussion
During the interactive moving of an item, the collection view calls this method to see if you want to provide a different index path than the proposed path. You might use this method to prevent the user from dropping the item in an invalid location. For example, you might prevent the user from dropping the item in a specific section.
See Also
Deprecated
collectionView(_:contextMenuConfigurationForItemAt:point:)collectionView(_:previewForDismissingContextMenuWithConfiguration:)collectionView(_:previewForHighlightingContextMenuWithConfiguration:)collectionView(_:shouldShowMenuForItemAt:)collectionView(_:canPerformAction:forItemAt:withSender:)collectionView(_:performAction:forItemAt:withSender:)