<!--
{
  "availability" : [
    "macOS: 10.6.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSWindow/preventsApplicationTerminationWhenModal",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSWindow(py)preventsApplicationTerminationWhenModal"
  },
  "title" : "preventsApplicationTerminationWhenModal"
}
-->

# preventsApplicationTerminationWhenModal

A Boolean value that indicates whether the window prevents application termination when modal.

```
var preventsApplicationTerminationWhenModal: Bool { get set }
```

## Discussion

The value of this property is <doc://com.apple.documentation/documentation/Swift/true> if the window prevents application termination when modal; otherwise, <doc://com.apple.documentation/documentation/Swift/false>. The default value is <doc://com.apple.documentation/documentation/Swift/true>.

Usually, application termination is prevented when a modal window or sheet is open, without consulting the application delegate. Some windows may wish not to prevent termination, however. Setting this property to <doc://com.apple.documentation/documentation/Swift/false> overrides the default behavior and allows termination to proceed even if the window is open, either through the sudden termination path if enabled, or after consulting the application delegate.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)