<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextInput/editMenu(for:suggestedActions:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITextInput(im)editMenuForTextRange:suggestedActions:"
  },
  "title" : "editMenu(for:suggestedActions:)"
}
-->

# editMenu(for:suggestedActions:)

Asks for the menu to display for the given text range and actions the system provides.

```
optional func editMenu(for textRange: UITextRange, suggestedActions: [UIMenuElement]) -> UIMenu?
```

## Parameters

`textRange`

The text range the menu is presenting for.

`suggestedActions`

The actions and commands the system suggests.

## Return Value

Returns a menu describing the desired menu hierarchy. Return `nil` to present the default system menu.

## Discussion

The following example returns a menu with additional actions in a submenu.

```swift
func editMenu(for textRange: UITextRange, suggestedActions: [UIMenuElement]) -> UIMenu? {
    let indentationMenu = UIMenu(title: "Indentation", image: UIImage(systemName: "list.bullet.indent"), children: [
        UIAction(title: "Increase", image: UIImage(systemName: "increase.indent")) { (action) in
            // Increase indentation action.
        },
        UIAction(title: "Decrease", image: UIImage(systemName: "decrease.indent")) { (action) in
            // Decrease indentation action.
        }
    ])

    var actions = suggestedActions
    actions.append(indentationMenu)
    return UIMenu(children: actions)
}
```

---

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)