The general purpose of converting an Int into a String is to display a "Score", which is incremented by one, every time a SKSpriteNode is tapped. The gesture is recognized by my GameScene class in GameScene.swift. It then uses a struct named "variables" to send the "Score" to my GameViewController which will display the score via UILabel. This is were I need to convert the Int into a String. Simple. Except every method I've tried has ended with the error: fatal error: unexpectedly found nil while unwrapping an Optional value. Furthermore, whenever I try to treat "Score" as an optional (add a '?') XCode gives me another error and tells me to remove it.
TL;DR: I need to convert an Int into a String, and all the methods that usually work aren't.
Method's I've tried:
scoreLabel.text = NSNumber(integer: Score).stringValuescoreLabel.text = "\(Score)"scoreLabel.text = String(Score)scoreLabel.text = toString(Score)scoreLabel.text = "\(Score.description)"scoreLabel.text = Score.descriptionscoreLabel.text = "\(NSNumber(integer: Score).stringValue)"
I've also restarted XCode and Mac. Have I missed something obvious? Please help a noob out.
EDIT #1: I forgot to mention that I've been logging "Score" in both GameScene.swift and GameViewController.swift; both return the correct value.
variablesstruct after every statement once it is created or modified, and print it's value just before being used. This will help you see what is going on tremendously. If I had to guess, I would say that you just aren't initializingvariablesproperly.