---
title: documentType
framework: foundation
role: symbol
role_heading: Type Property
path: foundation/nsattributedstring/documentattributekey/documenttype
---

# documentType

The document type.

## Declaration

```swift
static let documentType: NSAttributedString.DocumentAttributeKey
```

## Discussion

Discussion The value of this attribute is one of the document types declared in NSAttributedString.DocumentType. 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".

## See Also

### Getting document type keys

- [fileType](foundation/nsattributedstring/documentattributekey/filetype.md)
- [textEncodingName](foundation/nsattributedstring/documentattributekey/textencodingname.md)
