Contents

rtfdFileWrapper(from:documentAttributes:)

Returns a file wrapper object that contains an RTFD document corresponding to the characters and attributes within the specified range.

Declaration

func rtfdFileWrapper(from range: NSRange, documentAttributes dict: [NSAttributedString.DocumentAttributeKey : Any] = [:]) -> FileWrapper?

Parameters

  • range:

    The range.

  • dict:

    A required dictionary specifying the document attributes. The dictionary contains values from Document Types and must at least contain NSDocumentTypeDocumentAttribute.

Return Value

A file wrapper containing the RTFD data.

Discussion

The file wrapper also includes the document-level attributes in docAttributes, as explained in RTF Files and Attributed Strings.

Raises an rangeException if any part of aRange lies beyond the end of the receiver’s characters.

You can save the file wrapper using the write(toFile:atomically:updateFilenames:) method of FileWrapper.

See Also

Exporting the string as data