I want to change the text color of a CATextLayer.
This does not work
myTextLayer.textColor
since there is no such property. I also got no response by setting the foreground color
textLayer.foregroundColor = someColor.CGColor
when the text layer is set up as follows
let myAttribute = [ NSFontAttributeName: UIFont(name: mongolFontName, size: fontSize )! ]
let attrString = NSMutableAttributedString(string: textLayer.displayString, attributes: myAttribute )
textLayer.frame = myFrame
textLayer.string = attrString
I have seen the Objective-C question CATextLayer textcolor is always black but the answers there didn't seem to make sense in my situation.
Since I was able to solve my problem by reading the documentation, I am sharing the answer below.