data(from:documentAttributes:)
Returns a data object that contains a text stream corresponding to the characters and attributes within the specified range.
Declaration
func data(from range: NSRange, documentAttributes dict: [NSAttributedString.DocumentAttributeKey : Any] = [:]) throws -> DataParameters
- range:
The range.
- dict:
A required dictionary specifying the document attributes. The dictionary contains values from
Document Typesand must at least contain Documenttype.
Return Value
Returns the data for the attributed string, or nil if failure. When nil, error encapsulates the error information.
Discussion
Raises an rangeException if any part of range lies beyond the end of the receiver’s characters.