Instance Method


This action method simulates the user clicking the close button by momentarily highlighting the button and then closing the window.


func performClose(_ sender: Any?)



The message’s sender.


If the window’s delegate or the window itself implements windowShouldClose(_:), that message is sent with the window as the argument. (Only one such message is sent; if both the delegate and the NSWindow object implement the method, only the delegate receives the message.) If the windowShouldClose(_:) method returns false, the window isn’t closed. If it returns true, or if it isn’t implemented, performClose(_:) invokes the close() method to close the window.

If the window doesn’t have a close button or can’t be closed (for example, if the delegate replies false to a windowShouldClose(_:) message), the system emits the alert sound.

See Also

Closing Windows

func close()

Removes the window from the screen.

var isReleasedWhenClosed: Bool

A Boolean value that indicates whether the window is released when it receives the close message.