<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/NSDocumentTypeDocumentAttribute",
  "metadataVersion" : "0.1.0",
  "role" : "Global Variable",
  "symbol" : {
    "kind" : "Global Variable",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:@NSDocumentTypeDocumentAttribute"
  },
  "title" : "NSDocumentTypeDocumentAttribute"
}
-->

# NSDocumentTypeDocumentAttribute

The document type.

```
extern NSAttributedStringDocumentAttributeKey const NSDocumentTypeDocumentAttribute;
```

## Discussion

The value of this attribute is one of the document types declared in [`NSAttributedStringDocumentType`](/documentation/UIKit/NSAttributedStringDocumentType). For reader methods, this key in options can specify the document type for interpreting the contents. Upon return, the document attributes can contain this key for indicating the actual format used to read the contents. For write methods, this key specifies the format for generating the data.

The string constant in macOS 10.3 and earlier is `@"DocumentType"`.

---

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)