HelloGameKit/GameViewController.swift

/*
     Copyright (C) 2016 Apple Inc. All Rights Reserved.
     See LICENSE.txt for this sample’s licensing information
     
     Abstract:
     Top level view controller that sets of the scene
 */
 
import UIKit
import SpriteKit
import GameplayKit
 
class GameViewController: UIViewController {
    // MARK: UIViewController Overrides
 
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let scene = GKScene(fileNamed: "GameScene")!
        let sceneNode = scene.rootNode as! GameScene
        
        sceneNode.scaleMode = .aspectFill
        sceneNode.entities = scene.entities
        sceneNode.graphs = scene.graphs.map { return $0.value }
        
        let skView = view as! SKView
        skView.presentScene(sceneNode)
        
        skView.ignoresSiblingOrder = true
        
        skView.showsFPS = true
        skView.showsNodeCount = true
    }
 
    override var shouldAutorotate: Bool {
        return true
    }
 
    override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
        if UIDevice.current.userInterfaceIdiom == .phone {
            return .allButUpsideDown
        }
        else {
            return .all
        }
    }
 
    override var prefersStatusBarHidden: Bool {
        return true
    }
}