---
title: "textViewDidChangeSelection(_:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextviewdelegate/textviewdidchangeselection(_:)"
---

# textViewDidChangeSelection(_:)

Tells the delegate when the text selection changes in the specified text view.

## Declaration

```swift
optional func textViewDidChangeSelection(_ textView: UITextView)
```

## Parameters

- `textView`: The text view whose selection changed.

## Discussion

Discussion Implementation of this method is optional. You can use the selectedRange property of the text view to get the new selection.
