Contents

abortModal()

Aborts the event loop started by Runmodal(for:) or Runmodalsession(_:).

Declaration

func abortModal()

Discussion

When stopped with this method, runModal(for:) and runModalSession(_:) return NSModalResponseAbort.

abortModal() must be used instead of stopModal() or stopModal(withCode:) when you need to stop a modal event loop from anywhere other than a callout from that event loop. In other words, if you want to stop the loop in response to a user’s actions within the modal window, use stopModal(); otherwise, use abortModal(). For example, use abortModal() when running in a different thread from AppKit’s main thread or when responding to an NSTimer that you have added to the NSModalPanelRunLoopMode mode of the default NSRunLoop.

See Also

Related Documentation

Running a Modal Window