Structure

NSApplication.ModalResponse

Return values for runModal(for:) and runModalSession(_:).

Declaration

struct ModalResponse

Topics

Responses

static let OK: NSApplication.ModalResponse

The presentation or dismissal of the sheet has finished.

static let cancel: NSApplication.ModalResponse

The presentation or dismissal of the sheet has been canceled.

static let `continue`: NSApplication.ModalResponse

Modal session is continuing (returned by runModalSession(_:) only).

static let alertFirstButtonReturn: NSApplication.ModalResponse

The user clicked the first (rightmost) button on the dialog or sheet.

static let alertSecondButtonReturn: NSApplication.ModalResponse

The user clicked the second button from the right edge of the dialog or sheet.

static let alertThirdButtonReturn: NSApplication.ModalResponse

The user clicked the third button from the right edge of the dialog or sheet.

Deprecated Responses

var NSRunStoppedResponse: Int

Modal session was broken with stopModal().

Deprecated
var NSRunAbortedResponse: Int

Modal session was broken with abortModal().

Deprecated
var NSRunContinuesResponse: Int

Modal session is continuing (returned by runModalSession(_:) only).

Deprecated

Relationships

See Also

Running a Modal Window

func runModal(for: NSWindow) -> NSApplication.ModalResponse

Starts a modal event loop for the specified window.

func stopModal()

Stops a modal event loop.

func stopModal(withCode: NSApplication.ModalResponse)

Stops a modal event loop, allowing you to return a custom result code.

func abortModal()

Aborts the event loop started by runModal(for:) or runModalSession(_:).

func beginModalSession(for: NSWindow) -> NSApplication.ModalSession

Sets up a modal session with the given window and returns a pointer to the NSModalSession structure representing the session.

func runModalSession(NSApplication.ModalSession) -> NSApplication.ModalResponse

Runs a given modal session, as defined in a previous invocation of beginModalSession(for:).

var modalWindow: NSWindow?

The modal window displayed by the app.

typealias NSApplication.ModalSession

Variables of type NSModalSession point to information used by the system between NSApplication’s beginModalSession(for:) and endModalSession(_:) messages.

static let modalPanel: RunLoop.Mode

A run loop should be set to this mode when waiting for input from a modal panel, such as NSSavePanel or NSOpenPanel.