Create a new document whose contents are the same as the receiver’s and notify the delegate.
- macOS 10.7+
The delegate to which the selector message is sent.
The selector of the message sent to the delegate.
Object passed with the callback to provide any additional context information.
The new document that is created doesn’t yet have a value to return from
file. When duplicating is completed, regardless of success or failure, or whether the operation is rejected by the user, this method sends the message indicated by
did to the delegate, with
context as the last argument. The method selected by
did must have the same signature as:
The default implementation of this method first makes sure that any editor registered using the Cocoa Bindings
NSEditor informal protocol has committed its changes, then checks to see if there are recent changes that might have been inadvertent and, if so, presents a panel giving the user the choice of canceling, duplicating, or duplicating then discarding recent changes. Unless the user cancels duplicating, or if no panel was presented, it then invokes
duplicate(). If the user chose duplicating and discarding, it also discards recent changes after duplicating.