Instance Method

read(from:ofType:)

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

Declaration

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

Parameters

absoluteURL

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

typeName

The document type at absoluteURL.

outError

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.

Discussion

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.