---
title: "contextMenuInteraction(_:previewForHighlightingMenuWithConfiguration:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uicontextmenuinteractiondelegate/contextmenuinteraction(_:previewforhighlightingmenuwithconfiguration:)"
---

# contextMenuInteraction(_:previewForHighlightingMenuWithConfiguration:)

Returns the source view to use when animating the appearance of the preview interface.

## Declaration

```swift
optional func contextMenuInteraction(_ interaction: UIContextMenuInteraction, previewForHighlightingMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview?
```

## Parameters

- `interaction`: The interaction object that triggered the preview.
- `configuration`: The configuration object associated with the current interaction.

## Return Value

Return Value An object containing the source view and configuration parameters for the animation.

## Discussion

Discussion UIKit calls this method before an interaction begins, to give you an opportunity to supply a custom source view for the presentation animations. If you didn’t provide a preview handler block in the configuration data, UIKit displays the specified view in the preview interface.

## See Also

### Deprecated

- [contextMenuInteraction(_:previewForDismissingMenuWithConfiguration:)](uikit/uicontextmenuinteractiondelegate/contextmenuinteraction(_:previewfordismissingmenuwithconfiguration:).md)
