I am working to implement code that will move between 2 View Controllers, vc1 and vc2.
vc1 toggles between 2 SKViews, and vc2 just displays some simple things in UIView.
vc1 and vc2 are both in the main storyboard.
vc1 is displayed first, then at a point in an SKScene it segues to vc2:
let currentViewController: UIViewController = (self.view?.window?.rootViewController)!
currentViewController.performSegue(withIdentifier: "VC1toVC2", sender: currentViewController)
After a short delay in vc2, it segues back to vc1:
self.performSegue(withIdentifier: "VC2toVC1", sender: self)
These segues work.
Then, with the same code as above (using the same segue):
let currentViewController: UIViewController = (self.view?.window?.rootViewController)!
currentViewController.performSegue(withIdentifier: "VC1toVC2", sender: currentViewController)
...the 2nd time it does not work to segue from vc1 to vc2. There's no exception, just that vc2 does not display.
I found some other posts that don't address the issue, for example: * Swift segue not working? - suggests that UI updating has to be in main thread, and this one that shows how to do that in Swift 3 - How do I dispatch_sync, dispatch_async, dispatch_after, etc in Swift 3? --- I get the same result * other posts suggested using the view controller's .show or .present method --- I get the same result
Any thoughts/guidance?