---
title: "textField(_:textView:shouldSelectCandidateAt:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextfielddelegate/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.

## Declaration

```swift
@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.

## See Also

### Controlling Editing Behavior

- [textField(_:textView:candidates:forSelectedRange:)](appkit/nstextfielddelegate/textfield(_:textview:candidates:forselectedrange:).md)
- [textField(_:textView:candidatesForSelectedRange:)](appkit/nstextfielddelegate/textfield(_:textview:candidatesforselectedrange:).md)
