As the title states - I would like to make my SKLabelNodebold programmatically.
How do I go about this?
You can't set the SKLabelNode itself to bold. You have to use a Bold Font.
But if you want to use a custom font, you have to use one which is available in bold:
skLabel.fontName = "YourFontName-Bold"
skLabel.fontSize = 14
To get all fonts which are available on iOS check this site: http://iosfonts.com/
Here's a little extension for SKLabelNode. Allows you to toggle between bold and non-bold. Return value tells if it is currently set to bold.
extension SKLabelNode
{
func toggleBold() -> Bool
{
if var range = self.fontName.rangeOfString("-Bold")
{
self.fontName = self.fontName.substringToIndex(range.startIndex)
return false
}
else
{
self.fontName = self.fontName + "-Bold"
return true
}
}
}