Contents

beginCriticalSheet(_:completionHandler:)

Starts a document-modal session and presents the specified critical sheet.

Declaration

func beginCriticalSheet(_ sheetWindow: NSWindow, completionHandler handler: ((NSApplication.ModalResponse) -> Void)? = nil)
func beginCriticalSheet(_ sheetWindow: NSWindow) async -> NSApplication.ModalResponse

Parameters

  • sheetWindow:

    The window object that represents the critical sheet to present. A critical sheet contains content that is time-critical or very important to the user.

  • handler:

    The completion handler that gets called when the sheet’s modal session ends.

Discussion

This method displays the sheet—on top of the window’s current sheet, if one exists—makes it key and returns control to the caller. While the sheet remains visible, most events targeted at the receiver are prohibited. The runloop does not enter any special mode to accomplish this.

If the window already has a sheet when this method runs, the existing sheet is temporarily disabled while the critical sheet is presented. When the critical sheet is dismissed, the previously presented sheet continues its standard operation.

See Also

Managing Sheets