How to pull NSImage from NSTextAttachment in NSTextView?
问题 Goal is to allow user to add NSImage (s) to an NSAttributedString in an NSTextView , and then reverse the process and extract the image(s). With code from here, can add image(s) and have them displayed inline. let attributedText = NSMutableAttributedString(string: string, attributes: attributes as? [String : AnyObject]) let attachment = NSTextAttachment() let imageTest = NSImage(named:"sampleImage") as NSImage? let attachmentCell: NSTextAttachmentCell = NSTextAttachmentCell.init(imageCell: