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

# autosavingFileType

The document type to use for an autosave operation.

```
nonisolated var autosavingFileType: String? { get }
```

## Discussion

This properties contains a string that identifies the document type for autosave files. The default implementation just returns the value provided by the [`fileType`](/documentation/AppKit/NSDocument/fileType) property. You can override this property and return `nil` to completely disable autosaving of individual documents (because the [`NSDocumentController`](/documentation/AppKit/NSDocumentController) object does not call the  [`autosave(withDelegate:didAutosave:contextInfo:)`](/documentation/AppKit/NSDocument/autosave(withDelegate:didAutosave:contextInfo:)) method of a document that has no autosaving file type). You can also override it if your app defines a document type that is specifically designed for autosaving, for example, one that efficiently represents document content changes instead of complete document contents.

Overriding this property can result in incorrect behavior during reopening of autosaved documents. The `NSDocument` method [`init(for:withContentsOf:ofType:)`](/documentation/AppKit/NSDocument/init(for:withContentsOf:ofType:)), which is invoked during reopening of autosaved documents after a crash, takes two URLs, but only the type name of the autosaved contents file. The default implementation updates the [`fileType`](/documentation/AppKit/NSDocument/fileType) property with that type name, but that may not be the right thing to do if this property contains something other than [`fileType`](/documentation/AppKit/NSDocument/fileType) during document autosaving. If you override `autosavingFileType`, you probably need to override [`init(for:withContentsOf:ofType:)`](/documentation/AppKit/NSDocument/init(for:withContentsOf:ofType:)) too, and make the override update [`fileType`](/documentation/AppKit/NSDocument/fileType) with the type of the actual document file, after invoking `super`. See TextEdit’s `Document` class for an example of how to do this.

---

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)