April 2021
Beginner to intermediate
506 pages
11h 57m
English
Achievements are slightly different in how they are reported, as they require a bit more code than leaderboard score reporting. First, switch back to the GameKitHelper.swift file.
You’ll start by creating a new class. You could put this new class in a file of its own, but because there’s only one achievement in Hog Dice, you’ll add it to the GameKitHelper.swift file instead.
Above the delegate extension mark, add the following code:
| | // MARK: - ACHIEVEMENTS HELPER CLASS |
| | |
| | class AchievementsHelper { |
| | static let achievementIdFirstWin = "net.justwritecode.hogdice.first.win" |
| | |
| | class func firstWinAchievement(didWin: Bool) -> GKAchievement { |
| | let achievement = GKAchievement( |
| | identifier: AchievementsHelper ... |
Read now
Unlock full access