---
title: "read(from:options:documentAttributes:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsmutableattributedstring/read(from:options:documentattributes:)-967j7"
---

# read(from:options:documentAttributes:)

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

## Declaration

```swift
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 doc://com.apple.foundation/documentation/Foundation/NSAttributedString.
- `dict`: On return, contains the document attributes. For a list of possible values, see “Document Attributes” in doc://com.apple.foundation/documentation/Foundation/NSAttributedString.

## Return Value

Return Value true if the attributed string is created successfully or false if it was not.

## See Also

### Deprecated

- [read(from:options:documentAttributes:)](foundation/nsmutableattributedstring/read(from:options:documentattributes:)-85y1d.md)
- [read(fromFileURL:options:documentAttributes:)](foundation/nsmutableattributedstring/read(fromfileurl:options:documentattributes:).md)
