<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.11.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSMutableAttributedString/read(from:options:documentAttributes:)-967j7",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMutableAttributedString(im)readFromData:options:documentAttributes:"
  },
  "title" : "read(from:options:documentAttributes:)"
}
-->

# read(from:options:documentAttributes:)

Sets the contents of the receiver from the specified data object`.`

```
func read(from data: Data, options: [AnyHashable : Any] = [:], documentAttributes dict: AutoreleasingUnsafeMutablePointer<NSDictionary?>?) -> Bool
```

## Parameters

`data`

The data to read.

`options`

The option keys for importing the document. For a list of possible values, see “Option keys for importing documents” in [`NSAttributedString`](/documentation/Foundation/NSAttributedString).

`dict`

On return, contains the document attributes. For a list of possible values, see “Document Attributes” in [`NSAttributedString`](/documentation/Foundation/NSAttributedString).

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the attributed string is created successfully or <doc://com.apple.documentation/documentation/Swift/false> if it was not.

## Discussion

---

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)