I've create a UITextView that I've added to a UIView, this TextView should display an image at the top right or left corner wrapped by some text.
Creating the TextView isn't the issue (obviously), I just can't wrap my head around the NSAttributedString.
As for the image, I've used a NSTextAttachment;
var image:UIImage = UIImage(named: "placeHolder.png")
var textAttachment:NSTextAttachment = NSTextAttachment(data: nil, ofType: nil)
textAttachment.image = image
Then we've got some text for the TextView;
var text:String = "Lorem ipsum"
Now the tricky part. I can create an NSAttributedString that can be set to the UITextView. It displays the image just fine, I just can't figure out how to set the text.
var s:NSAttributedString = NSAttributedString(attachment: textAttachment)
textView.attributedText = s
Any ideas?