performClose(_:)
Simulates the user clicking the close button by momentarily highlighting the button and then closing the window.
Declaration
func performClose(_ sender: Any?)Parameters
- sender:
The message’s sender.
Discussion
If the window’s delegate or the window itself implements windowShouldClose(_:), the window sends that message with the window as the argument. The window sends only one such message; if both the delegate and the window implement the method, the delegate receives the message. If the windowShouldClose(_:) method returns false, the window doesn’t close. If neither the window nor the delegate implement windowShouldClose(_:), or it returns true, this method invokes close() to close the window.
If the window doesn’t have a close button or can’t close (for example, if the delegate replies false to a windowShouldClose(_:) message), the system emits the alert sound.