Search code examples
iosswiftsprite-kituikituitabbarcontroller

Sprite Kit into UITabBarController


I am new to Sprite Kit, so bare with the beginner question here.

I currently have a full app written out using 4 tabs through a UITabBarController, all of my constraints done through Storyboard files.

What is the best way for me to add a Sprite Kit scene as an introduction to the app?

Basically, I want to add a little introductory ~30 second long game, which then transitions directly into what I already have.

I have already created a GameScene (SKScene) and a GameViewController (UIViewController) and the app loads into the scene now, but I'm not sure how to get to the UITabBarController now.

I only know about view.presentScene() to transition out of Sprite Kit. Is there no way to easily hook up the two here?

Thanks in advance!


Solution

  • Since you are familiar with UIKit, I won't dumb it down for you. Use the storyboard to create the segue from the SKView to the UITabController, then perform the segue viewController.performSegue(withIdentifier: "showTabs", sender: nil) where you are thinking of calling view.presentScene to go to the tab controller. Note, you need to somehow access the view controller from your scene, either by creating a delegate or searching the app delegate.