Accessing a SpriteKit Scene’s View Controller

If you’re using Game Center in a SpriteKit game, you present Game Center view controllers to show things like leaderboards and achievements. To present a Game Center view controller, you need to access the SpriteKit scene’s view controller. The good news is accessing the scene’s view controller takes only one line of code. Adding the following line of Swift code in your SKScene subclass gives you access to the scene’s view controller: