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

# textShouldEndEditing(_:)

Performs validation on the text field’s new value.

## Declaration

```swift
func textShouldEndEditing(_ textObject: NSText) -> Bool
```

## Parameters

- `textObject`: The text object that requests permission to end editing.

## Return Value

Return Value true if the new value is valid; otherwise, false.

## Discussion

Discussion This method validates the text field’s new value using the NSCell method isEntryAcceptable:. If the new value is valid and the delegate responds to control(_:textShouldEndEditing:), this method invokes that method and returns the result. If the delegate returns false, the system beeps to indicate that the text field can’t validate the text. See NSControl for more information about the text delegate method.

## See Also

### Implementing Delegate Methods

- [textShouldBeginEditing(_:)](appkit/nstextfield/textshouldbeginediting(_:).md)
- [textDidBeginEditing(_:)](appkit/nstextfield/textdidbeginediting(_:).md)
- [textDidChange(_:)](appkit/nstextfield/textdidchange(_:).md)
- [textDidEndEditing(_:)](appkit/nstextfield/textdidendediting(_:).md)
