I have a simple game app that I developed in Swift. I have a button in an options screen that will allow the user to quit the current game and return to the start screen. I have looked into several ways to do this, but I'm not sure which way is the correct way.
Option 1: I created a exit function and defined that function in the main ViewController, it looks something like this:
@IBAction func unwindToHome(s:UIStoryboardSegue) {
println("unwind to home");
}
Then I just controlled drag to the exit icon from the quit button inside the Options View Controller. This works, but gives me some unexpected results. As it's unwinding through my View Controllers, it's triggering code along the way, which by the time it gets back to the root VC there are some errors that are happening.
Option 2: Control drag from the quit button back to the root VC. This works, and doesn't cause any errors but I just don't know if this is good practice. Does this remove all the other VC's from the stack, or am I just starting a new game on top of the old one?