<!--
{
  "availability" : [
    "iOS: 13.0.0 - 16.0.0",
    "iPadOS: 13.0.0 - 16.0.0",
    "macCatalyst: 13.1.0 - 16.0.0",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIContextMenuInteractionDelegate/contextMenuInteraction(_:previewForHighlightingMenuWithConfiguration:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UIContextMenuInteractionDelegate(im)contextMenuInteraction:previewForHighlightingMenuWithConfiguration:"
  },
  "title" : "contextMenuInteraction(_:previewForHighlightingMenuWithConfiguration:)"
}
-->

# contextMenuInteraction(_:previewForHighlightingMenuWithConfiguration:)

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

```
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

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

## 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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)