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

# textDidEndEditing(_:)

Posts a notification when the text is no longer in edit mode.

## Declaration

```swift
func textDidEndEditing(_ notification: Notification)
```

## Parameters

- `notification`: The doc://com.apple.appkit/documentation/AppKit/NSControl/textDidEndEditingNotification to post to the default notification center.

## Discussion

Discussion After validating the new value, this method posts a textDidEndEditingNotification to the default notification center, which causes the text field’s delegate to receive a controlTextDidEndEditing: message. This method then sends endEditing(_:) to the text field’s cell and handles the key that causes editing to end as follows: If the user ends editing by pressing Return, this method tries to send the text field’s action to its target. If unsuccessful, it sends performKeyEquivalent(with:) to its NSView, for example, to handle the default button on a panel. If that also fails, the text field selects its text. If the user ends editing by pressing Tab or Shift-Tab, the text field tries to have its NSWindow object select its next or previous key view, using the NSWindow method selectKeyView(following:) or selectKeyView(preceding:). If unsuccessful, the text field selects its 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)
- [textShouldEndEditing(_:)](appkit/nstextfield/textshouldendediting(_:).md)
