---
title: "init(RTFD:documentAttributes:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsattributedstring/init(rtfd:documentattributes:)"
---

# init(RTFD:documentAttributes:)

Creates an attributed string by decoding the stream of RTFD commands and data in the specified data object.

## Declaration

```swift
init?(RTFD data: Data, documentAttributes dict: AutoreleasingUnsafeMutablePointer<NSDictionary?>?)
```

```swift
init?(rtfd data: Data, documentAttributes dict: AutoreleasingUnsafeMutablePointer<NSDictionary?>?)
```

## Parameters

- `data`: The data containing the RTFD content.
- `dict`: An in-out dictionary containing document-level attributes. On output, this method updates the dictionary to contain any document-specific keys found in the data. Specify nil if you don’t want the document attributes.

## Return Value

Return Value Returns an initialized attributed string object, or nil if the method can’t decode the data.

## See Also

### Creating from RTF

- [init(RTF:documentAttributes:)](foundation/nsattributedstring/init(rtf:documentattributes:).md)
- [init(RTFDFileWrapper:documentAttributes:)](foundation/nsattributedstring/init(rtfdfilewrapper:documentattributes:).md)
