<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIEditMenuInteraction",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIEditMenuInteraction"
  },
  "title" : "UIEditMenuInteraction"
}
-->

# UIEditMenuInteraction

An interaction that provides edit operations using a menu.

```
@MainActor class UIEditMenuInteraction
```

## Overview

Edit menu interactions provide edit actions — such as cut, copy, and paste — for the content a view displays. The presentation style the interaction uses to display the actions conforms to the input method of the interaction. For touch interactions, the actions display in an editing menu. When responding to a secondary click on devices with pointer-based input, the actions display in a context menu.

Standard UIKit classes, such as [`UITextView`](/documentation/UIKit/UITextView) and [`UITextField`](/documentation/UIKit/UITextField), are preconfigured to use edit menu interactions.

To add an edit menu interaction to a generic view:

1. Create an edit menu interaction object, and pass an optional delegate into the default initializer.
2. Call the [`addInteraction(_:)`](/documentation/UIKit/UIView/addInteraction(_:)) method on your view to add the interaction.
3. Create a gesture recognizer to trigger the interaction and add it to the view.

The following example creates an edit menu interaction triggered by a long press.

```swift
override func viewDidLoad() {
    super.viewDidLoad()

    // Add the edit menu interaction.
    editMenuInteraction = UIEditMenuInteraction(delegate: self)
    interactionView.addInteraction(editMenuInteraction!)

    // Create the gesture recognizer.
    let longPress = UILongPressGestureRecognizer(target: self, action: #selector(didLongPress(_:)))
    longPress.allowedTouchTypes = [UITouch.TouchType.direct.rawValue as NSNumber]
    interactionView.addGestureRecognizer(longPress)
}

@objc func didLongPress(_ recognizer: UIGestureRecognizer) {
    let location = recognizer.location(in: self.view)
    let configuration = UIEditMenuConfiguration(identifier: nil, sourcePoint: location)

    if let interaction = editMenuInteraction {
        // Present the edit menu interaction.
        interaction.presentEditMenu(with: configuration)
    }
}
```

By default, an edit menu interaction generates a menu that includes commands for the standard edit actions your view implements. For more information on these actions, see [`UIResponderStandardEditActions`](/documentation/UIKit/UIResponderStandardEditActions). You can use the interaction’s delegate to add additional items to the menu and set the target rectangle to display around using methods in the [`UIEditMenuInteractionDelegate`](/documentation/UIKit/UIEditMenuInteractionDelegate) protocol. For text views, you can specify the items the menu displays for specific text ranges using methods from the [`UITextViewDelegate`](/documentation/UIKit/UITextViewDelegate), [`UITextFieldDelegate`](/documentation/UIKit/UITextFieldDelegate), or [`UITextInput`](/documentation/UIKit/UITextInput) protocols.

> Related Sessions from WWDC22:
> Session 10071: [Adopt desktop-class editing interactions](https://developer.apple.com/wwdc22/10071)

## Topics

### Creating an edit menu interaction

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

Initializes an edit menu interaction object with the delegate object you specify.

### Managing edit menu interactions

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

An object that customizes presentation of the menu and actions to display for an edit menu interaction.

[`presentEditMenu(with:)`](/documentation/UIKit/UIEditMenuInteraction/presentEditMenu(with:))

Presents an edit menu using the object you provide for configuration.

[`reloadVisibleMenu()`](/documentation/UIKit/UIEditMenuInteraction/reloadVisibleMenu())

Updates the actions an edit menu displays.

[`updateVisibleMenuPosition(animated:)`](/documentation/UIKit/UIEditMenuInteraction/updateVisibleMenuPosition(animated:))

Updates the position of the currently visible menu with an option to animate the action.

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

Dismiss the edit menu if present.

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

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

## See Also

[Building a desktop-class iPad app](/documentation/UIKit/building-a-desktop-class-ipad-app)

Optimize your iPad app’s user experience by adopting desktop-class enhancements for multitasking with Stage Manager, document interactions, text editing, search, and more.



---

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)