Initializer

init(rtf:documentAttributes:)

Initializes a new attributed string object by decoding the stream of RTF commands and data contained in the given data object.

Declaration

init?(rtf data: Data, documentAttributes dict: AutoreleasingUnsafeMutablePointer<NSDictionary?>?)

Parameters

rtfData

The data containing RTF content.

docAttributes

An in-out dictionary containing document-level attributes described in Document Attributes. May be NULL, in which case no document attributes are returned.

Return Value

Returns an initialized object, or nil if the data can’t be decoded.

Discussion

Also returns by reference in docAttributes a dictionary containing document-level attributes described in Document Attributes. docAttributes may be NULL, in which case no document attributes are returned. Returns an initialized object, or nil if rtfData can’t be decoded.

See Also

Creating an NSAttributedString Object

init(string: String)

Returns an NSAttributedString object initialized with the characters of a given string and no attribute information.

init(string: String, attributes: [NSAttributedStringKey : Any]? = nil)

Returns an NSAttributedString object initialized with a given string and attributes.

init(attributedString: NSAttributedString)

Returns an NSAttributedString object initialized with the characters and attributes of another given attributed string.

init(data: Data, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:], documentAttributes: AutoreleasingUnsafeMutablePointer<NSDictionary?>?)

Initializes and returns a new attributed string object from the data contained in the given data object.

init?(docFormat: Data, documentAttributes: AutoreleasingUnsafeMutablePointer<NSDictionary?>?)

Initializes and returns a new NSAttributedString object from Microsoft Word format data contained in the given NSData object.

init?(html: Data, documentAttributes: AutoreleasingUnsafeMutablePointer<NSDictionary?>?)

Initializes and returns a new NSAttributedString object from HTML contained in the given data object.

init?(html: Data, baseURL: URL, documentAttributes: AutoreleasingUnsafeMutablePointer<NSDictionary?>?)

Initializes and returns a new NSAttributedString object from the HTML contained in the given object and base URL.

init?(rtfd: Data, documentAttributes: AutoreleasingUnsafeMutablePointer<NSDictionary?>?)

Initializes a new attributed string object by decoding the stream of RTFD commands and data contained in the given data object.

init?(rtfdFileWrapper: FileWrapper, documentAttributes: AutoreleasingUnsafeMutablePointer<NSDictionary?>?)

Initializes a new attributed string object from the specified file wrapper containing an RTFD document.

init(attachment: NSTextAttachment)

Creates an attributed string with an attachment.