---
title: "collectionView(_:contextMenuConfiguration:dismissalPreviewForItemAt:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uicollectionviewdelegate/collectionview(_:contextmenuconfiguration:dismissalpreviewforitemat:)"
---

# collectionView(_:contextMenuConfiguration:dismissalPreviewForItemAt:)

Asks the delegate for a preview of the item at the specified index path when a context-menu interaction ends.

## Declaration

```swift
optional func collectionView(_ collectionView: UICollectionView, contextMenuConfiguration configuration: UIContextMenuConfiguration, dismissalPreviewForItemAt indexPath: IndexPath) -> UITargetedPreview?
```

## Parameters

- `collectionView`: The collection view containing the item.
- `configuration`: The configuration of the menu to dismiss.
- `indexPath`: The index path of the item where the menu dismissal occurs.

## Return Value

Return Value A targeted preview object corresponding to the item at the index path to use during the menu’s dismissal animation.

## Discussion

Discussion The system calls this method when a context menu dismisses from the collection view. Implement this method to override the default dismissal preview that the collection view generates for the item at indexPath.

## See Also

### Managing context menus

- [Adding context menus in your app](uikit/adding-context-menus-in-your-app.md)
- [collectionView(_:willDisplayContextMenu:animator:)](uikit/uicollectionviewdelegate/collectionview(_:willdisplaycontextmenu:animator:).md)
- [collectionView(_:willEndContextMenuInteraction:animator:)](uikit/uicollectionviewdelegate/collectionview(_:willendcontextmenuinteraction:animator:).md)
- [collectionView(_:willPerformPreviewActionForMenuWith:animator:)](uikit/uicollectionviewdelegate/collectionview(_:willperformpreviewactionformenuwith:animator:).md)
- [collectionView(_:contextMenuConfigurationForItemsAt:point:)](uikit/uicollectionviewdelegate/collectionview(_:contextmenuconfigurationforitemsat:point:).md)
- [collectionView(_:contextMenuConfiguration:highlightPreviewForItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:contextmenuconfiguration:highlightpreviewforitemat:).md)
