1

It took me almost 3 days to figured out that my problem was that I set the label font to Helvetica .And every time I will want to change it's text will lag.So my question is whats the problem with Helvetica and SKLabel node.When I set it out I thought it was Helvetica Neue.

Stefan Scoarta
  • 781
  • 9
  • 21

1 Answers1

3

There is no problem with the font itself but with how the SKLabelNode handles the Font usage. The problem is, that the SKLabelNode checks/loads the font each time you access it. To stop Swift from doing that, you should create the font at start like that:

let theFont = UIFont(name: "Helvetica", size: 17)

//Access the font like that in your label
theFont?.fontName

The trick here is, that Swift has a reference to your font and doesn't have to load the font new each time. Because currently Swift checks the Font each time.

Something else you could try is, if you didn't do it already, to preload the font:

var yourLabel = SKLabelNode(fontNamed: "Helvetica Neue")
Christian
  • 22,585
  • 9
  • 80
  • 106