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

# textShouldEndEditing(_:)

Invoked from a text object’s implementation of resignFirstResponder(), this method requests permission for aTextObject to end editing.

## Declaration

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

## Discussion

Discussion If the delegate returns true, the text object proceeds to finish editing and resign first responder status. If the delegate returns false, the text object selects all of its text and remains the first responder.

## See Also

### Related Documentation

- [resignFirstResponder()](appkit/nsresponder/resignfirstresponder().md)

### Editing text

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