---
title: "selectText(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextfield/selecttext(_:)"
---

# selectText(_:)

Ends editing in the text field and, if it’s selectable, selects the entire text content.

## Declaration

```swift
func selectText(_ sender: Any?)
```

## Parameters

- `sender`: The sender of the message.

## Discussion

Discussion If the text field isn’t in a window’s view hierarchy, this method has no effect.
