iOS15NSTextAttachment

     NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
     attachment.image = image;
     attachment.bounds = CGRectMake(0, (font.capHeight - image.size.height) / 2, 15, image.size.height);
     NSMutableAttributedString *imageString = [[NSAttributedString attributedStringWithAttachment:attachment] mutableCopy];

Do you have any questions? If so, please clarify what you want to ask.

I have the same question, image width expands

how can I solve this?

hi i fixed the issue by adding " " in front of image, which fontsize if 0

this issue has been fixed on ios15.2

attText.appendAttributedString(" ", font: UIFont.systemFont(ofSize: 0))
iOS15NSTextAttachment
 
 
Q