I tried to set some attributes to an NSAttributedString. Everything works except for the foreground color.
This is how I tried to set the attributes:
func setLabelText(text:String){
let strokeTextAttributes = [
NSAttributedString.Key.strokeColor : UIColor.white,
NSAttributedString.Key.foregroundColor : UIColor.red,
NSAttributedString.Key.font : UIFont.init(name: "Raleway-ExtraBold", size: 26)!,
NSAttributedString.Key.strokeWidth : 0.5,
]
as [NSAttributedString.Key : Any]
label.attributedText = NSMutableAttributedString(string: text, attributes: strokeTextAttributes)
}
As you can see in the image it does not set the text color:
Do you know why it ignores the foregroundColor attribute?
Thanks in advance.