Instance Method


Reverts a document to the most recent document data stored on-disk.


func revert(toContentsOf url: URL, completionHandler: ((Bool) -> Void)? = nil)



A file URL locating the most recent version of the document file in the application’s sandbox.


A block with code to execute after the reversion operation concludes. The block returns no value and has one parameter:


true if the reversion operation succeeds, otherwise false.

The block is invoked on the main queue.


You call this method to discard all unsaved document modifications and replace the document's contents by reading the file or file package located by url. The default implementation brackets the reversion operation between disableEditing() and enableEditing()because the document should not accept user changes during this period. Subclasses that override this method must call the superclass implementation (super) or use the NSFileCoordinator class to initiate a coordinated read.