Context
This question is related to Swift: SKSpriteKit, using Storyboards, UIViewController and UIButton to set in game parameters? and uses the same M.W.E. (link below).
Taking a look at the Main.storyboard
we see the following:
While this storyboard would allow one to progress from left to right by clicking:
play -> (easy/hard) -> GameScene
UIViewController
-> MyUIViewController
-> GameViewController
and from right to left by clicking the UIButton
on the last UIViewController
with the UILabel
stating "Score", there is not a way to get from GameViewController
to the last UIViewController
with the "Score" UILabel
.
Question
Given a certain event occurring during the GameScene
, how can I pass some information (e.g. a score) from the GameScene
and transition to the last last UIViewController
so that the user can start the game over again. In addition to deleting everything in the GameViewController
as to not just end up with unreachable old instances of the GameScene
.
For the certain condition, let that be tapping the purple sprite in the M.W.E. For the information, let that be something trivial like the time until the sprite was pressed, or even just a random number.
Minimum Working Example
Note
My answer here - and implemented hereStackOverflow SKSpriteKit with Menu - shows that this is clearly possible, but by relegating everything to SKView
s rather than using a storyboard
. So if possible, please keep answers related to using this hybrid storyboard
-SKView
approach and how to have the GameScene
call up the "Score"-UIViewController
.