Contents

document(for:)

Returns, for a given URL, the open document whose file or file package is located by the URL, or nil if there is no such open document.

Declaration

func document(for url: URL) -> NSDocument?

Parameters

  • url:

    The URL of the document you wish to look up.

Return Value

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

Discussion

The default implementation of this method queries each open document to find one whose URL matches, and returns the first one whose URL does match.

See Also

Creating and Opening Documents