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

# isDocumentEdited

A Boolean value that indicates whether the window’s document has been edited.

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

## Discussion

The value of this property is <doc://com.apple.documentation/documentation/Swift/true> when the window’s document has been edited; otherwise, <doc://com.apple.documentation/documentation/Swift/false>. Initially, by default, `NSWindow` objects are in the “not edited” state.

You should set [`isDocumentEdited`](/documentation/AppKit/NSWindow/isDocumentEdited) to <doc://com.apple.documentation/documentation/Swift/true> every time the window’s document changes in such a way that it needs to be saved. Conversely, when the document is saved, you should set the property to <doc://com.apple.documentation/documentation/Swift/true> when the window’s document has been edited; otherwise, <doc://com.apple.documentation/documentation/Swift/false>. Then, before closing the window you can examine the value of the property to determine whether to allow the user a chance to save the document.

---

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)