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

# read(from:options:documentAttributes:)

Sets the contents of receiver from the file at the specified URL.

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

## Parameters

`url`

The URL of the document to open.

`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

Filter services can be used to convert the contents of the URL into a format recognized by Cocoa.

---

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)