representedURL
The URL of the file the window represents.
Declaration
var representedURL: URL? { get set }Discussion
When the URL specifies a path, the window shows an icon in its title bar, as described in the following table:
File path | Document icon |
|---|---|
Empty | None |
Specifies a nonexistent file | Generic |
Specifies an existent file | Specific for the file’s type |
You can customize the file icon in the title bar with the following code:
[[<window> standardWindowButton:NSWindowDocumentIconButton] setImage:<image>]When the URL identifies an existing file, the window’s title offers a pop-up menu showing the path components of the URL. (The user displays this menu by Command-clicking the title.) The behavior and contents of this menu can be controlled with window(_:shouldPopUpDocumentPathMenu:).