The NSEditor informal protocol is implemented by controllers and user interface elements. It provides a means for requesting that the receiver commit or discard any pending edits.


These methods are typically invoked on user interface elements by a controller. They can also be sent to a controller in response to a user’s attempt to save a document or quit an application.

NSController provides an implementation of this protocol, as do the Application Kit user interface elements that support binding.


Managing editing

func discardEditing()

Causes the receiver to discard any changes, restoring the previous values.

func commitEditing()

Returns whether the receiver was able to commit any pending edits.

func commitEditingAndReturnError()

Attempt to commit pending edits, returning an error in the case of failure.