SwiftUI AttributedString not working attachment

I want to present image with his custom modifiers in swiftui with iOS 15 but it does not, what is wrong in this code ?

@available(iOS 15, *)
    func setupLabel() -> AttributedString {
        var title = AttributedString(text ?? "")
        var container = AttributeContainer()
        container.foregroundColor = .red
        let imageAttachment = NSTextAttachment()
        imageAttachment.image = UIImage(named: "star")
        imageAttachment.bounds = CGRect(x: 0,
                                        y: 0,
                                        width: 20,
                                        height: 20)
        container.attachment = imageAttachment
        title.mergeAttributes(container)
       return title
    }

foregroundColor works but image doesn't display.

Did you manage to find a solution?

SwiftUI AttributedString not working attachment
 
 
Q