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


class GKPlayer : GKBasePlayer


Every player account on Game Center is permanently assigned a unique player identifier string. Your game should use this string to store per-player information or to disambiguate between players. In most cases, Game Kit classes return player identifier strings to your game. For example, in a multiplayer match, the GKMatch object’s playerIDs property contains an array of the player identifiers for all the players connected to the match.

To load information about a set of players, your game calls the loadPlayers(forIdentifiers:withCompletionHandler:) method, passing in an array of identifier strings. Your completion handler is called after the player data is downloaded from Game Center. For performance and resource reasons, player objects returned by the loadPlayers(forIdentifiers:withCompletionHandler:) method do not include player photos. To load the photo associated with a player, call the player object’s loadPhoto(for:withCompletionHandler:) method.

The concept of guest players is introduced in iOS 9. Guest players are treated exactly like authenticated players for Game Center multiplayer purposes. However, guest players cannot earn achievements, post to leaderboards, or participate in challenges. Create a guest player with the anonymousGuestPlayer(withIdentifier:) method.


Loading Player Details

Identifying the Player

var playerID: String

A unique identifier associated with a player.


Player Details

var alias: String

A string chosen by the player to identify themselves to other players.

var displayName: String

A string to display for the player.

var isFriend: Bool

A Boolean value that indicates whether this player is a friend of the local player.


Player Photos

enum GKPlayer.PhotoSize

The size of a photo loaded by Game Center.

Creating a Guest Player

class func anonymousGuestPlayer(withIdentifier: String) -> Self

Creates a new guest player with the designated identifier.

var guestIdentifier: String?

A developer created string used to identify a guest player.


static let GKPlayerDidChangeNotificationName: NSNotification.Name

Posted when a player object’s data changes.


Inherits From

Conforms To

See Also


class GKLocalPlayer

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

class GKBasePlayer

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

protocol GKLocalPlayerListener

A protocol that handles events for Game Center accounts.

protocol GKInviteEventListener

A protocol that handles invite events from Game Center.