---
title: "contextMenuInteraction(_:configuration:dismissalPreviewForItemWithIdentifier:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uicontextmenuinteractiondelegate/contextmenuinteraction(_:configuration:dismissalpreviewforitemwithidentifier:)"
---

# contextMenuInteraction(_:configuration:dismissalPreviewForItemWithIdentifier:)

Asks the delegate for a preview of the item with the specified identifier when a context-menu interaction ends.

## Declaration

```swift
optional func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configuration: UIContextMenuConfiguration, dismissalPreviewForItemWithIdentifier identifier: any NSCopying) -> UITargetedPreview?
```

## Parameters

- `interaction`: The context-menu interaction object.
- `configuration`: The configuration of the menu to dismiss.
- `identifier`: The identifier for the item to generate a preview for.

## Return Value

Return Value A targeted preview object corresponding to the item with the identifier to use during the menu’s dismissal animation.

## Discussion

Discussion The system calls this method when a context-menu dismissal occurs. Implement this method to override the default dismissal preview that the system generates for the item.

## See Also

### Customizing the preview animations

- [contextMenuInteraction(_:configuration:highlightPreviewForItemWithIdentifier:)](uikit/uicontextmenuinteractiondelegate/contextmenuinteraction(_:configuration:highlightpreviewforitemwithidentifier:).md)
- [Adding menus and shortcuts to the menu bar and user interface](uikit/adding-menus-and-shortcuts-to-the-menu-bar-and-user-interface.md)
