<!--
{
  "availability" : [
    "macOS: 10.12.2 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextFieldDelegate/textField(_:textView:shouldSelectCandidateAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextFieldDelegate(im)textField:textView:shouldSelectCandidateAtIndex:"
  },
  "title" : "textField(_:textView:shouldSelectCandidateAt:)"
}
-->

# textField(_:textView:shouldSelectCandidateAt:)

Notifies the delegate that the user selected the candidate at index in `-[NSCandidateListTouchBarItem candidates]` for the text view’s `candidateListTouchBarItem`. Returns a Boolean value that indicates whether to select the text object at the index.

```
@MainActor optional func textField(_ textField: NSTextField, textView: NSTextView, shouldSelectCandidateAt index: Int) -> Bool
```

## Parameters

`textField`

The text field that sent the message.

`textView`

The text view that sent the message.

`index`

The index that represents the start of the candidate text to evaluate, or `NSNotFound` if no candidate is to be selected.

---

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)