Show the Game Center Dashboard

Apple Game Frameworks and Technologies — by Tammy Coron (156 / 193)

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Create the Game Center Helper | TOC | Report Score to Leaderboard 👉

You already know that Hog Dice doesn’t use the Game Center Access Point. However, players will still need a way to access the Game Center Dashboard because what’s the point of adding Game Center features if players can’t access them, right?

In Hog Dice, you’ll provide a way for players to access the dashboard, leaderboards, and achievements using the following three buttons:

images/AddingLeaderboardsAndAchievements/gc-buttons.png

These three buttons are the main access points into the Game Center. The first one is located in the lobby scene, while the other two are located in the game over scene.

Using the Game Center View Controller

The first step is to create another shared view controller. Switch to the GameKitHelper.swift file and add a new property:

​ ​var​ gameCenterViewController: ​GKGameCenterViewController​?

The GKGameCenterViewController class is the single user interface that displays the Game Center information.

As you did with the authentication controller, you’ll use a notification to present the controller. In the…

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.