NSTextAttachment objects are used by the
NSAttributedString class cluster as the values for attachment attributes (stored in the attributed string under the key named
NSAttachmentAttributeName). The objects you create with this class are referred to as text attachment objects, or when no confusion will result, as text attachments or merely attachments.
- iOS 7.0+
- macOS 10.0+
- tvOS 7.0+
A text attachment object contains either an
NSData object or an
FileWrapper object, which in turn holds the contents of the attached file. The properties of this class configure the appearance of the text attachment in your interface. In macOS, the text attachment also uses a cell object conforming to the
NSTextAttachmentCellProtocol protocol to draw and handle mouse events.