I am able to display a single leaderboard. I created a leaderboard set in iTunes Connect and I am not sure how to save the scores into different leaderboards in a leaderboard set. I am also not sure how to display all of the leaderboard in my leaderboard set in the Game Center's view controller.
func saveHighScore(highscore:Int){
if GKLocalPlayer.localPlayer().authenticated {
let scoreReporter = GKScore(leaderboardIdentifier: "easymodehighscores")
scoreReporter.value = Int64(highScore)
let scoreArray : [GKScore] = [scoreReporter]
GKScore.reportScores(scoreArray, withCompletionHandler: nil)
}
}
This is my code for saving a high score into one of the leaderboards.
let viewController = self.view.window?.rootViewController
let gameCenterVC = GKGameCenterViewController()
gameCenterVC.gameCenterDelegate = self
viewController?.presentViewController(gameCenterVC, animated: true, completion: nil)
This is my code for presenting the Game Center view controller.