---
title: "editMenu(for:suggestedActions:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextinput/editmenu(for:suggestedactions:)"
---

# editMenu(for:suggestedActions:)

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

## Declaration

```swift
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

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

## Discussion

Discussion The following example returns a menu with additional actions in a submenu. 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) }

## See Also

### Managing the edit menu

- [willPresentEditMenu(animator:)](uikit/uitextinput/willpresenteditmenu(animator:).md)
- [willDismissEditMenu(animator:)](uikit/uitextinput/willdismisseditmenu(animator:).md)
