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

# contextMenuInteraction(_:configuration:highlightPreviewForItemWithIdentifier:)

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

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

## Parameters

`interaction`

The context-menu interaction object.

`configuration`

The configuration of the menu to present if the interaction proceeds.

`identifier`

The identifier for the item to generate a preview for.

## Return Value

A targeted preview object corresponding to the item with the identifier to use during the menu’s highlight and presentation animation.

## Discussion

The system calls this method when a context-menu interaction begins. Implement this method to override the default highlight preview that the system generates for the item.

---

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)