Contents

windowShouldClose(_:)

Tells the delegate that the user has attempted to close a window or the window has received a Performclose(_:) message.

Declaration

@MainActor optional func windowShouldClose(_ sender: NSWindow) -> Bool

Parameters

  • sender:

    The window being closed.

Return Value

true to allow sender to be closed; otherwise, false.

Discussion

This method may not always be called during window closing. Specifically, this method is not called when a user quits an application.

See Also

Closing Windows