<!--
{
  "availability" : [
    "macOS: 15.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextSuggestionsDelegate/textField(_:didSelect:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "s:6AppKit25NSTextSuggestionsDelegateP9textField_9didSelectySo0cG0C_AA16NSSuggestionItemVy010SuggestionK4TypeQzGtF"
  },
  "title" : "textField(_:didSelect:)"
}
-->

# textField(_:didSelect:)

Called when an item in the suggestions menu has been selected.

```
@MainActor func textField(_ textField: NSTextField, didSelect item: Self.Item)
```

## Parameters

`textField`

The text field whose suggestions item was highlighted.

`item`

The item that was selected.

## Discussion

The default implementation inserts the item’s text completion (`textField(_:textCompletionFor:)`) into the control, replacing its existing text. Overriding this method allows you to do a custom behavior instead.

---

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)