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

# keepBackupFile

A Boolean value that indicates whether the document archives previously saved versions of the document.

```
nonisolated var keepBackupFile: Bool { get }
```

## Discussion

The default value of this property is <doc://com.apple.documentation/documentation/Swift/false>, which causes each new save operation to replace the document’s on-disk content. If you override this method and return <doc://com.apple.documentation/documentation/Swift/true>, a save operation saves the document’s previous contents in a backup file before saving the current contents.

## See Also

[`writeToFile:ofType:`](/documentation/AppKit/NSDocument/writeToFile:ofType:)

Writes document data to a file.



---

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)