Instance Method

panel(_:validate:)

For NSSavePanel delegates, asks the delegate for file URL validation when the user chooses the Save button. For NSOpenPanel delegates, asks the delegate for file URL validation once for each selected filename (or directory) when the user chooses the Open button.

Declaration

optional func panel(_ sender: Any, validate url: URL) throws

Parameters

sender

The panel requesting URL validation.

url

The URL to be validated.

outError

If an error occurred during validation, the error that occurred.

Return Value

true if the URL is an acceptable URL to save to or to open; otherwise, false.

Discussion

See Also

Running Panels

func panel(Any, shouldEnable: URL) -> Bool

For NSOpenPanel delegates, asks the delegate whether the specified URL should be enabled in the panel. This method is not called for NSSavePanel delegates; all URLs are always disabled.

func panel(Any, didChangeToDirectoryURL: URL?)

Informs the delegate that the user changed the selected directory to the directory located at the specified URL. The URL may be nil if the current URL can’t be represented by an NSURL object.

func panel(Any, userEnteredFilename: String, confirmed: Bool) -> String?

Tells the delegate that the user confirmed a filename choice by clicking Save in a Save panel.

func panel(Any, willExpand: Bool)

Tells the delegate that the Save panel is about to expand or collapse because the user clicked the disclosure triangle that displays or hides the file browser.

func panelSelectionDidChange(Any?)

Tells the delegate that the user changed the selection in the specified Save panel.