---
title: readOnly
framework: foundation
role: symbol
role_heading: Type Property
path: foundation/nsattributedstring/documentattributekey/readonly
---

# readOnly

An indication of whether the document is read-only.

## Declaration

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

## Discussion

Discussion The value of this attribute is an NSNumber object that contains an integer. A value of 1 indicates read-only. If the value is 0, missing, or negative, the document doesn’t display as read-only. This attribute is not related to the file system protection on the file. Instead, this attribute can affect how the file displays to the user. The string constant in macOS 10.3 and earlier is @"ReadOnly".

## See Also

### Getting document metadata keys

- [author](foundation/nsattributedstring/documentattributekey/author.md)
- [category](foundation/nsattributedstring/documentattributekey/category.md)
- [characterEncoding](foundation/nsattributedstring/documentattributekey/characterencoding.md)
- [cocoaVersionDocumentAttribute](foundation/nsattributedstring/documentattributekey/cocoaversiondocumentattribute.md)
- [comment](foundation/nsattributedstring/documentattributekey/comment.md)
- [company](foundation/nsattributedstring/documentattributekey/company.md)
- [converted](foundation/nsattributedstring/documentattributekey/converted.md)
- [copyright](foundation/nsattributedstring/documentattributekey/copyright.md)
- [creationTime](foundation/nsattributedstring/documentattributekey/creationtime.md)
- [editor](foundation/nsattributedstring/documentattributekey/editor.md)
- [keywords](foundation/nsattributedstring/documentattributekey/keywords.md)
- [manager](foundation/nsattributedstring/documentattributekey/manager.md)
- [modificationTime](foundation/nsattributedstring/documentattributekey/modificationtime.md)
- [subject](foundation/nsattributedstring/documentattributekey/subject.md)
- [title](foundation/nsattributedstring/documentattributekey/title.md)
