Instance Method


Displays an alert asking if the user wants to review unsaved documents, quit regardless of unsaved documents, or cancel the save operation.


func reviewUnsavedDocuments(withAlertTitle title: String?, cancellable: Bool, delegate: Any?, didReviewAllSelector: Selector?, contextInfo: UnsafeMutableRawPointer?)



The title of the alert.


A Boolean indicating whether the operation can be canceled.


The object that calls the selector.


The selector to call when all documents have been reviewed.


A pointer to user-supplied data.


Assigns delegate to the panel. Calls didReviewAllSelector with true if quit without saving is chosen or if there are no dirty documents, and false otherwise. If the user selects the “Review Unsaved” option, closeAllDocuments(withDelegate:didCloseAllSelector:contextInfo:) is called. This method is called when the user chooses the Quit menu command, and also when the computer power is being turned off. Note that title is ignored. Pass the contextInfo object with the callback.

The didReviewAllSelector callback method should have the following signature:

- (void)documentController:(NSDocumentController *)docController  didReviewAll: (BOOL)didReviewAll contextInfo:(void *)contextInfo

See Also

Closing Documents

func closeAllDocuments(withDelegate: Any?, didCloseAllSelector: Selector?, contextInfo: UnsafeMutableRawPointer?)

Iterates through all the open documents and tries to close them one by one using the specified delegate.