How to make a segue from SpriteKit GameScene to UIViewController programmatically in iOS 9 with Swift2

845 views Asked by At

I need to make a segue from a GameScene to a UIViewController but i keep getting Use of unresolved identifier "push" although I did give it that identifier

In the GameSceneViewController I added

scene.viewController = self

and in my GameScene I added

var viewController: UIViewController?

and

func segue(){

    self.viewController.performSegueWithIdentifier(push, sender: viewController)

}
1

There are 1 answers

1
vrwim On BEST ANSWER

Segue identifiers are String objects, so you should call performSegueWithIdentifier with "push" instead of referencing it as a variable.

This code should work:

func segue(){

    self.viewController.performSegueWithIdentifier("push", sender: viewController)
}