swiftgif / SwiftGif

[UNMAINTAINED] 🌠 A small UIImage extension with gif support
MIT License
1.33k stars 306 forks source link

added gif into NSTextAttachment, but not animated #95

Open fukemy opened 4 years ago

fukemy commented 4 years ago

hi, i loaded success gif image into my attribute string, but it can not animate, it's hard to me to know the problem

let attachment = NSTextAttachment()
                                    attachment.image = UIImage.gif(url: getEmojiUrl(name: data.Data))
                                    attachment.bounds = CGRect(x: 0, y: ((UIFont.systemFont(ofSize: 16).capHeight) - 28).rounded() / 2, width: 28, height: 28)
                                    let replacement = NSAttributedString(attachment: attachment)
                                    attributedString.replaceCharacters(in: aMatch.range, with: replacement)

Screen Shot 2020-06-11 at 15 22 08

this is sample link i loaded https://devlink.vedax.ai/images/emotions/cry.gif