<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIContextMenuInteractionDelegate",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UIContextMenuInteractionDelegate"
  },
  "title" : "UIContextMenuInteractionDelegate"
}
-->

# UIContextMenuInteractionDelegate

The methods for providing the set of actions to perform on your content, and for customizing the preview of that content.

```
@MainActor protocol UIContextMenuInteractionDelegate : NSObjectProtocol
```

## Overview

Use this protocol to provide UIKit with the contextual menu that you want to display. When a [`UIContextMenuInteraction`](/documentation/UIKit/UIContextMenuInteraction) object detects an appropriate interaction, it calls the [`contextMenuInteraction(_:configurationForMenuAtLocation:)`](/documentation/UIKit/UIContextMenuInteractionDelegate/contextMenuInteraction(_:configurationForMenuAtLocation:)) method of your delegate. You use that method to specify the basic configuration details for your interface. In addition to your contextual menu, you can tell UIKit whether you want it to display a default preview interface or a custom view controller that you provide. You can also specify options for how you want UIKit to animate the presentation and dismissal of that interface.

For additional information about how to implement contextual menus, see [Adding context menus in your app](/documentation/UIKit/adding-context-menus-in-your-app).

## Topics

### Providing the preview configuration data

[`contextMenuInteraction(_:configurationForMenuAtLocation:)`](/documentation/UIKit/UIContextMenuInteractionDelegate/contextMenuInteraction(_:configurationForMenuAtLocation:))

Returns the configuration data to use when previewing the content.

[`UIContextMenuConfiguration`](/documentation/UIKit/UIContextMenuConfiguration)

An object containing the configuration details for the contextual menu.

### Customizing the preview animations

[`contextMenuInteraction(_:configuration:highlightPreviewForItemWithIdentifier:)`](/documentation/UIKit/UIContextMenuInteractionDelegate/contextMenuInteraction(_:configuration:highlightPreviewForItemWithIdentifier:))

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

[`contextMenuInteraction(_:configuration:dismissalPreviewForItemWithIdentifier:)`](/documentation/UIKit/UIContextMenuInteractionDelegate/contextMenuInteraction(_:configuration:dismissalPreviewForItemWithIdentifier:))

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

[Adding menus and shortcuts to the menu bar and user interface](/documentation/UIKit/adding-menus-and-shortcuts-to-the-menu-bar-and-user-interface)

Provide quick access to useful actions by adding menus and keyboard shortcuts to your Mac app built with Mac Catalyst.

### Responding to the menu’s appearance

[`contextMenuInteraction(_:willPerformPreviewActionForMenuWith:animator:)`](/documentation/UIKit/UIContextMenuInteractionDelegate/contextMenuInteraction(_:willPerformPreviewActionForMenuWith:animator:))

Informs the delegate when a preview action begins.

[`UIContextMenuInteractionCommitAnimating`](/documentation/UIKit/UIContextMenuInteractionCommitAnimating)

Methods adopted by system-supplied animator objects when committing preview-related animations.

### Handling animations

[`contextMenuInteraction(_:willDisplayMenuFor:animator:)`](/documentation/UIKit/UIContextMenuInteractionDelegate/contextMenuInteraction(_:willDisplayMenuFor:animator:))

Informs the delegate when a menu display begins.

[`contextMenuInteraction(_:willEndFor:animator:)`](/documentation/UIKit/UIContextMenuInteractionDelegate/contextMenuInteraction(_:willEndFor:animator:))

Informs the delegate when a menu display ends.

[`UIContextMenuInteractionAnimating`](/documentation/UIKit/UIContextMenuInteractionAnimating)

Methods adopted by system-supplied animator objects when interacting with context menus.

### Deprecated

[`contextMenuInteraction(_:previewForHighlightingMenuWithConfiguration:)`](/documentation/UIKit/UIContextMenuInteractionDelegate/contextMenuInteraction(_:previewForHighlightingMenuWithConfiguration:))

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

[`contextMenuInteraction(_:previewForDismissingMenuWithConfiguration:)`](/documentation/UIKit/UIContextMenuInteractionDelegate/contextMenuInteraction(_:previewForDismissingMenuWithConfiguration:))

Returns the destination view to use when animating the appearance of 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)