Instance Method

write(to:ofType:for:originalContentsURL:)

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

Declaration

func write(to absoluteURL: URL, ofType typeName: String, for saveOperation: NSDocument.SaveOperationType, originalContentsURL absoluteOriginalContentsURL: URL?) throws

Parameters

absoluteURL

An URL that specifies the new location for the document store. It must not be a relative URL.

typeName

The document type.

saveOperation

The save operation type. See the "Constants" section in NSDocument for possible values.

absoluteOriginalContentsURL

An URL that specifies the location of the original document store.

error

If the save fails to complete correctly, upon return contains an NSError object that describes the problem.

Return Value

true if the save completes correctly, otherwise false.

Discussion

See Also

Document Content Management

func read(from: URL, ofType: String)

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

func revert(toContentsOf: URL, ofType: String)

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