I'm trying to bold part of a text in a UITextView. Here is the code I'm using (though I simplified the text):
@IBOutlet weak var textview: UITextView!
/*...*/
var str : NSMutableAttributedString = NSMutableAttributedString(string:"this is a test", attributes: [NSFontAttributeName:textview.font!] )
str.addAttribute(NSFontAttributeName, value: UIFont(name: "GillSans-Bold", size: 16)!, range: NSMakeRange(10, 4))
textview.attributedText = str
However it is not working and I don't understand why... All the examples I've seen use this. There is no error, but nothing in the text is in bold.
Sorry if it's a duplicate, I found plenty of posts talking about putting text in bold in a uitextview, some used this technique but none had problems with it, as far as I know. Is there something I missed? Did I read something wrong?
Thanks in advance.