Hi team , I’m trying to implement a code to back to homescreen from a game scene , I created a main view, after clicking in a button my game starts , but when the game finish my intention is go back to homeScreen… I got an error , someone can help on that ?
override func touchesBegan(touches: Set, withEvent event: UIEvent?) {
if gameState == .GameOver {
let mainStoryboard = UIStoryboard(name: "Main", bundle: nil)
let home = mainStoryboard.instantiateViewControllerWithIdentifier("HomeScreenViewController")
self.view!.window?.rootViewController?.presentViewController(home, animated: true, completion: nil)
// restartGame()
}
}