<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextSelectionManager/Delegate-swift.protocol/textSelection",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextSelectionManagerDelegate(py)textSelection"
  },
  "title" : "textSelection"
}
-->

# textSelection

The current text selection.

```
var textSelection: NSTextSelection? { get set }
```

## Discussion

The text selection manager updates this property in response to user interactions. The delegate is responsible for storing and providing access to the current selection. The [`NSTextLocation`](/documentation/AppKit/NSTextLocation) values that make up the [`NSTextRange`](/documentation/AppKit/NSTextRange) objects can be any object that can describe a location in your text.

---

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)