---
title: "prefersRTFD(in:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsattributedstring/prefersrtfd(in:)"
---

# prefersRTFD(in:)

Returns a Boolean value that indicates whether the specified range of text prefers RTFD formatting.

## Declaration

```swift
func prefersRTFD(in range: NSRange) -> Bool
```

## Parameters

- `range`: The range of text to test.

## Return Value

Return Value true if the range of text prefers RTFD formatting, or false if you can use the RTF format instead.

## Discussion

Discussion When an attributed string contains attachments, you must save it using the RTFD file format to preserve the attached files.

## See Also

### Getting the supported text-file formats

- [textTypes](foundation/nsattributedstring/texttypes.md)
- [textUnfilteredTypes](foundation/nsattributedstring/textunfilteredtypes.md)
