Contents

beginSheetModal(for:completionHandler:)

Presents the panel as a sheet modal to the specified window.

Declaration

func beginSheetModal(for window: NSWindow, completionHandler handler: @escaping (NSApplication.ModalResponse) -> Void)
func beginSheetModal(for window: NSWindow) async -> NSApplication.ModalResponse

Parameters

Discussion

Configure all the relevant properties of the panel before you call this method. The completion handler block runs after the user dismisses the panel, but while the panel may still be onscreen. If you need to dismiss the panel from the screen—for example, if the completion block displays an alert—close the panel by calling its orderOut(_:) method with the value nil.

See Also

Showing the Panel