Initializer

init(for:withContentsOf:ofType:)

Initializes a document located by a URL of a specified type, but by reading the contents for the document from a different URL.

Declaration

convenience init(for urlOrNil: URL?, withContentsOf contentsURL: URL, ofType typeName: String) throws

Parameters

absoluteDocumentURL

The URL where the document is located.

absoluteDocumentContentsURL

The URL from which the contents of the document are obtained.

typeName

The string that identifies the document type.

outError

On return, if initialization is unsuccessful, a pointer to an error object that encapsulates the reason the document could not be created.

Return Value

The initialized NSDocument object, or, if the document could not be created, nil.

Discussion

The absoluteDocumentURL argument is nil if the initializing is part of the reopening of an autosaved document when the autosaved document was never explicitly saved.

During reopening of autosaved documents, this method uses the following NSDocumentChangeType constant to indicate that an autosaved document is being reopened:

NSChangeReadOtherContents

See Also

Initializing

init()

Initializes and returns an empty NSDocument object.

init(contentsOf: URL, ofType: String)

Initializes a document located by a URL of a specified type.

init(type: String)

Initializes a document of a specified type.