I have two ViewControllers. One that is the main menu of my game, called MenuViewController, and another one which is the level you play in, called ViewController. To get to the level, from the menu, I use a segue. To go back to the menu from the level I use dismissViewControllerAnimated, like this:
func leaveScene() {
self.dismissViewControllerAnimated(true, completion: nil)
}
What I wanted to know is, I have a variable called x for example, and I want to pass its value to the MenuViewController so I can access it there. How can this be done?