<!--
{
  "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/UIContextMenuInteraction",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIContextMenuInteraction"
  },
  "title" : "UIContextMenuInteraction"
}
-->

# UIContextMenuInteraction

An interaction object that you use to display relevant actions for your content.

```
@MainActor class UIContextMenuInteraction
```

## Overview

Use a [`UIContextMenuInteraction`](/documentation/UIKit/UIContextMenuInteraction) object to focus the user’s attention on a specific portion of your content, and to provide actions for the user to perform on that content. A context menu interaction object tracks Force Touch gestures on devices that support 3D Touch, and long-press gestures on devices that don’t support it. When the appropriate gesture occurs, this object animates your content to a new interface and displays the contextual menu that you supplied. UIKit manages all menu-related interactions and reports the selected action, if any, back to your app.

A context menu interaction object inherits from [`UIInteraction`](/documentation/UIKit/UIInteraction). After creating the object, assign an appropriate object to its [`delegate`](/documentation/UIKit/UIContextMenuInteraction/delegate) property and use the [`addInteraction(_:)`](/documentation/UIKit/UIView/addInteraction(_:)) method to attach it to one of your views. The delegate object you provide must adopt the [`UIContextMenuInteractionDelegate`](/documentation/UIKit/UIContextMenuInteractionDelegate) protocol. Use the methods of that object to provide the contents of the contextual menu. Add your context menu interaction object to a view in your interface using the view’s [`addInteraction(_:)`](/documentation/UIKit/UIView/addInteraction(_:)) method.

## Topics

### Creating a context menu interaction object

[`init(delegate:)`](/documentation/UIKit/UIContextMenuInteraction/init(delegate:))

Creates a context menu interaction object with the specified delegate object.

[Adding context menus in your app](/documentation/UIKit/adding-context-menus-in-your-app)

Provide quick access to useful actions by adding context menus to your iOS app.

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

### Previewing and managing the content

[`delegate`](/documentation/UIKit/UIContextMenuInteraction/delegate)

The object that provides the preview and contextual menu for your content and responds to interaction-related events.

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

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

### Getting the interaction’s location

[`location(in:)`](/documentation/UIKit/UIContextMenuInteraction/location(in:))

Returns the location of the user interaction in the specified view’s coordinate system.

### Getting the menu appearance

[`menuAppearance`](/documentation/UIKit/UIContextMenuInteraction/menuAppearance)

The appearance of the context menu.

[`UIContextMenuInteraction.appearance`](/documentation/UIKit/UIContextMenuInteraction/appearance)

Constants that describe the appearance of the menu.

### Managing menu interactions

[`dismissMenu()`](/documentation/UIKit/UIContextMenuInteraction/dismissMenu())

Dismisses the context menu.

[`updateVisibleMenu(_:)`](/documentation/UIKit/UIContextMenuInteraction/updateVisibleMenu(_:))

Updates the currently visible menu.



---

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)