How can I switch to a UIViewController while an SKScene is loaded and vice versa? I have so far been able to implement NSNotificationCenter to tell my GameViewController to switch, but I am having trouble with what code to run to actually change Scenes. Here is my GameViewController.swift file:
import UIKit
import SpriteKit
import StoreKit
class GameViewController: UIViewController {
override func viewDidLoad() {
NSNotificationCenter.defaultCenter().addObserver(self, selector: "openArtboard:", name:"OpenArtboard", object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "openHomeScreen:", name:"OpenHomeScreen", object: nil)
//Load the initial home screen
let scene = homeScreen(size: view.bounds.size)
let skView = view as SKView
skView.showsFPS = true
skView.showsNodeCount = true
skView.ignoresSiblingOrder = false
scene.scaleMode = .ResizeFill
skView.presentScene(homeScreen(size: skView.bounds.size))
}
func openArtboard(NSNotificationCenter) {
//Dont know what to put here
}
func openHomeScreen(NSNotificationCenter) {
//Dont know what to put here
}
}
Any help is much appreciated.