Framework

GameKit

Create experiences that keep players coming back to your game. Add leaderboards, achievements, matchmaking, challenges, and more.

Overview

GameKit offers features that you can use to create great social games.

GameKit Features

GameKit provides you with the ability to create apps that allow players to interact with each other. Multiplayer apps allow your game to create realtime network matches. Players can invite other players to join their game. Most importantly, players can receive invitations to join a match even when your game is not running. Your game is running on each device and the instances of your game exchange match and voice data with each other. Turn-Based Gaming provides store-and-forward network match infrastructure where the match is played out over a series of discrete turns. This kind of match can be played without requiring all of the players to be connected simultaneously.

Starting in iOS 10.0, GameKit provides the ability to create multiplayer and turn-based using GKGameSession. Game sessions use a player's iCloud account to invite other players to a game, save game data, and transfer data between players. Game sessions fully support the tracking aspects of Game Center. Game Center offers a centralized game service that connects players to each other. Game Center implements many different features:

  • Achievements provide the ability to track a player’s accomplishments in your game.

  • Leaderboards allow your game to store and fetch player scores from Game Center.

  • Challenges allow a player to challenge other players to complete an achievement or to beat a leaderboard score.

Topics

Game Sessions

class GKGameSession

A game session used for saving game data, inviting other players, and creating turn-based and realtime game apps.

protocol GKGameSessionEventListener

An event listener that handles game session events.

class GKGameSessionSharingViewController

A user interface that provides the ability to invite other users into a tvOS game session.

Players

class GKCloudPlayer

The object representing the currently signed in iCloud user.

class GKLocalPlayer

An object representing the authenticated Game Center player on a device.

class GKPlayer

An object that provides information about a player on Game Center.

class GKBasePlayer

The top level player object containing basic identifying information for a player.

protocol GKLocalPlayerListener

The protocol that handles events for Game Center accounts.

protocol GKInviteEventListener

The protocol that handles invite events from Game Center.

Leaderboards

class GKLeaderboard

An object used to read data from a leaderboard stored on Game Center.

class GKLeaderboardSet

An object that organizes leaderboards into logical and coherent groups.

class GKScore

An object containing information for a score that was earned by the player.

Achievements

class GKAchievement

An object that communicates with Game Center about the local player’s progress towards completing an achievement.

class GKAchievementDescription

An object holding text and images used to describe an achievement for an app.

Challenges

class GKChallenge

An object representing a challenge issued by the local player to another player.

class GKScoreChallenge

An object representing a challenge based on a score in a leaderboard.

class GKAchievementChallenge

A challenge sent to another player urging them to complete a specific achievement.

protocol GKChallengeListener

An object that responds to challenge events.

View Controllers

class GKGameCenterViewController

A single user interface used to display achievements and leaderboards supported by Game Center.

class GKDialogController

An object that provides the ability to present Game Center view controller classes in macOS.

protocol GKViewController

A protocol adopted by Game Center view controller classes.

Errors

struct GKError

Error codes for the GKError domain.

struct GKGameSessionError

Error codes for the GKGameSession domain.

Legacy and Deprecated Symbols

Legacy Symbols

Use these legacy classes to support multiplayer and turn-based gaming in iOS 9.0, macOS 10.11, tvOS 9.0 and earlier.

Deprecated Symbols

GameKit APIs that have been deprecated and are no longer supported.

See Also