Instance Method


Sets the contents of the receiver by reading from a file of a given type located by a given URL.


func read(from absoluteURL: URL, ofType typeName: String) throws



An URL that specifies the location from which to read the document.


The document type at absoluteURL.


If absoluteURL is not valid, or the store at absoluteURL cannot be read, upon return contains an NSError object that describes the problem

Return Value

true if absoluteURL is valid and the file is read correctly, otherwise false.


This method sets the URL for the persistent object store associated with the receiver’s managed object context to absoluteURL.

See Also

Document Content Management

func revert(toContentsOf: URL, ofType: String)

Overridden to clean up the managed object context and controllers during a revert.

func write(to: URL, ofType: String, for: NSDocument.SaveOperationType, originalContentsURL: URL?)

Saves changes in the document’s managed object context and saves the document’s persistent store to a given URL.