---
title: "collectionView(_:willPerformPreviewActionForMenuWith:animator:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uicollectionviewdelegate/collectionview(_:willperformpreviewactionformenuwith:animator:)"
---

# collectionView(_:willPerformPreviewActionForMenuWith:animator:)

Informs the delegate when a user triggers a commit by tapping the preview.

## Declaration

```swift
optional func collectionView(_ collectionView: UICollectionView, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: any UIContextMenuInteractionCommitAnimating)
```

## Parameters

- `collectionView`: The collection view that informs the delegate of this event.
- `configuration`: The configuration of the menu being displayed.
- `animator`: The animations to run alongside the commit transition.

## 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(_:contextMenuConfigurationForItemsAt:point:)](uikit/uicollectionviewdelegate/collectionview(_:contextmenuconfigurationforitemsat:point:).md)
- [collectionView(_:contextMenuConfiguration:highlightPreviewForItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:contextmenuconfiguration:highlightpreviewforitemat:).md)
- [collectionView(_:contextMenuConfiguration:dismissalPreviewForItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:contextmenuconfiguration:dismissalpreviewforitemat:).md)
