Just in case, someone is interested in my solution:
In principle, text with a stroke (border) can be made without using CoreText directly. The string property CATextLayer accepts NSAttributedStrings. Therefore, it would be as simple as providing the NSAttributedString with the color of the stroke and the width of the stroke in its attributes.
Unfortunately, I needed to animate the font size. The string property is animated, but only if it is an NSString. So I decided to subclass CATextLayer. After much effort, I realized that the string and the properties of the CATextLayer content are mutually exclusive, which means the string or content is being displayed. I could not understand how to draw a string myself. The display and drawInContext: ctx methods are only called when the content is updated, but I did not know what I would need to call to update the line.
So, I decided to write my own CATextLayer class, subclassing CALayer. I created an animated property called fontSize. When this one is animated, the drawInContext: ctx method is called. In the drawInContext: ctx method, I create a new line with a CoreText and update its size accordingly using the fontSize property.
source share