<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextViewDelegate/textViewDidChangeSelection(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITextViewDelegate(im)textViewDidChangeSelection:"
  },
  "title" : "textViewDidChangeSelection(_:)"
}
-->

# textViewDidChangeSelection(_:)

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

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

## Parameters

`textView`

The text view whose selection changed.

## Discussion

Implementation of this method is optional. You can use the [`selectedRange`](/documentation/UIKit/UITextView/selectedRange) property of the text view to get the new selection.

---

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)