0

The structure of my storyboard:

1.Screen1 (UIViewController)

2.GameScreen (SKScene)

3.Screen3 (UIViewController)

I'm passing UIViewController self object from Screen1

//Screen1 class

@IBAction func onStartButtonClicked(_ sender: Any) {
    Values.viewController = self
}

to GameScreen, when making a segue:

//GameScreen class 

struct Values {
   static var viewController: UIViewController!
}

class GameScreen: SKScene {...}

My task is to make a segue from GameScreen to Screen3 using object of Screen1, which has been passed from previous step:

Values.viewController!.performSegue(withIdentifier: "toScoreSegue1", sender:  self)

Everything should work fine, since I dragged a segue from Screen1 to Screen3, gave it identifier "toScoreSegue1" and calling it using Screen1 object. However, nothing happens.

There is no error etc.

Any help would be highly appreciated!

NickitaX
  • 352
  • 2
  • 14

1 Answers1

0

I figured out a problem!

By mistake, I called performSegue on wrong ViewController.

I had to call segue on ViewController that initialized SKScene view:

1.Screen1 (UIViewController)

2.GameScreen (SKScene) - has its own ViewController, which should be used instead of Screen1!

3.Screen3 (UIViewController)

I really hope somebody with same problem may find it helpful.

NickitaX
  • 352
  • 2
  • 14