Attempts to commit any pending changes in known editors of the receiver.
- macOS 10.4+
An object that can serve as the receiver's delegate. It should implement the method specified by
A selector that is invoked on delegate. The method specified by the selector must have the same signature as the following method:
Contextual information that is sent as the
contextargument to delegate when
Provides support for the NSEditor informal protocol. This method attempts to commit pending changes in known editors. Known editors are either instances of a subclass of
NSController or (more rarely) user interface controls that may contain pending edits—such as text fields—that registered with the context using
object and have not yet unregistered using a subsequent invocation of
The receiver iterates through the array of its known editors and invokes
commit on each. The receiver then sends the message specified by the
did selector to the specified delegate.
did argument is the value returned by the editor specified by
editor from the
commit message. The
context argument is the same value specified as the
context parameter—you may use this value however you wish.
If an error occurs while attempting to commit, for example if key-value coding validation fails, your implementation of this method should typically send the view in which editing is being performed a
present message, specifying the view's containing window.
You may find this method useful in some situations (typically if you are using Cocoa Bindings) when you want to ensure that pending changes are applied before a change in user interface state. For example, you may need to ensure that changes pending in a text field are applied before a window is closed. See also
commit which performs a similar function but which allows you to handle any errors directly, although it provides no information beyond simple success/failure.