---
title: "textView(_:editMenuForTextInRanges:suggestedActions:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextviewdelegate/textview(_:editmenufortextinranges:suggestedactions:)"
---

# textView(_:editMenuForTextInRanges:suggestedActions:)

## Declaration

```swift
optional func textView(_ textView: UITextView, editMenuForTextInRanges ranges: [NSValue], suggestedActions: [UIMenuElement]) -> UIMenu?
```

## Parameters

- `textView`: The text view requesting the menu.
- `ranges`: The text ranges for which the menu is presented for.
- `suggestedActions`: The actions and commands that the system suggests.

## Return Value

Return Value Return a UIMenu describing the desired menu hierarchy. Return @c nil to present the default system menu.

## Discussion

Discussion Asks the delegate for the menu to be shown for the specified text ranges. If the delegate does not implement this method then the textView:editMenuForTextInRange:suggestedActions: method will be called and passed the union range instead. If the delegate also does not implement that method then nil is assumed.
