As simple as this question may seem, I just couldn't figure it out. To the overflow community, I am using sprite kit to create a simple game, However when you lose the game I want to programmatically segue back to another viewController (basically the home screen). from The game scene I do not get access to "performSegueWithIdentifier" I've seen a couple answers that relate to this topic however non of them are in swift ... Any solutions? links of related questions include : Link1 Thank You
How to segue to View Controller from skview
223 views Asked by Chris Mazile At
2
I think you are misunderstanding SKViews. SKViews are just like a normal UIViews, they take place within a normal ViewController. You will therefore need to segue from the ViewController which is presenting your SKView.
I have the same issue in a game I have created (Ninja-Shooter). In my game, whenever I want to segue back the home screen I pass a value to
NSUserDefaults.standardUserDefaults()
. Then in my ViewController I am constantly listening for any change in that value, if the value does change, then I perform a segue.Hope this helps!