So im trying to show a score on a scene using NSUserDefaults using the below:
var savedScore: Int = NSUserDefaults.standardUserDefaults().objectForKey("HighestScore") as! Int
let score = SKLabelNode()
score.text = toString(savedScore)
score.fontName = "Menlo-Regular";
score.fontColor = UIColor.blackColor();
score.position = CGPointMake(self.frame.size.width * 0.3, self.frame.size.height / 2)
self.addChild(score)
But the first time this is ran, because there isn't anything in "HighestScore" yet, its crashing the app for trying to load a nil value. How can i have the score label show 0 the very first time this scene is ran, and then show whatever is in "HighestScore" every other time after.