April 2021
Beginner to intermediate
506 pages
11h 57m
English
In Handling Game-Related Data, you created the classes responsible for modeling the game’s custom game-related data. For Hog Dice, that data includes two players and their scores. The next step is to use that data to manage and maintain the multiplayer game’s current state.
You’ll start by adding a new property to the GameKitHelper class. Below the matchmakerViewController property, add the following code:
| | // Turn-based match properties |
| | var currentMatch: GKTurnBasedMatch? |
You’ll use this property to store the current match.
The next step is to add the “turn” methods in the new GameKitHelper extension—the one that implements the GKLocalPlayerListener protocol.
Below the player(_:receivedTurnEventFor:didBecomeActive:) ...
Read now
Unlock full access