---
title: GKPlayer
framework: gamekit
role: symbol
role_heading: Class
path: gamekit/gkplayer
---

# GKPlayer

A remote player who the local player running your game can invite and communicate with through Game Center.

## Declaration

```swift
class GKPlayer
```

## Mentioned in

Protecting the player’s privacy using scoped identifiers Authenticating a player

## Overview

Overview Before using Game Center for the first time, players create a single account that identifies them across all Game Center games. The player only needs to sign in to Game Center once per device to start using GameKit features in your game. A player sets a nickname and avatar in their account that provide a consistent and familiar look in your game. Game Center then uses the account to record leaderboard scores and achievements, and to start games with other players. In your code, GKPlayer represents remote or other players who the local player running your app can invite and communicate with. GKPlayer is also the superclass for the local player GKLocalPlayer class that provides common data and methods for all players. For example, use the alias property to get the nickname for a player. To load the player avatars, use the loadPhoto(for:withCompletionHandler:) method. To create a guest player who doesn’t have a Game Center account, use the anonymousGuestPlayer(withIdentifier:) method. GameKit treats guest players similar to Game Center players except they can’t earn achievements, post to leaderboards, or participate in challenges. Use the gamePlayerID property as a unique identifier for just your game, and the teamPlayerID property as a unique identifier for all games that you offer through your developer account. For more information, see Protecting the player’s privacy using scoped identifiers.

## Topics

### Identifying the player

- [gamePlayerID](gamekit/gkplayer/gameplayerid.md)
- [teamPlayerID](gamekit/gkplayer/teamplayerid.md)
- [scopedIDsArePersistent()](gamekit/gkplayer/scopedidsarepersistent().md)
- [GKPlayerIDNoLongerAvailable](gamekit/gkplayeridnolongeravailable.md)
- [playerID](gamekit/gkplayer/playerid.md)

### Accessing player details

- [alias](gamekit/gkplayer/alias.md)
- [displayName](gamekit/gkplayer/displayname.md)
- [isInvitable](gamekit/gkplayer/isinvitable.md)
- [isFriend](gamekit/gkplayer/isfriend.md)

### Loading player photos

- [loadPhoto(for:withCompletionHandler:)](gamekit/gkplayer/loadphoto(for:withcompletionhandler:).md)
- [GKPlayer.PhotoSize](gamekit/gkplayer/photosize.md)

### Creating a guest player

- [anonymousGuestPlayer(withIdentifier:)](gamekit/gkplayer/anonymousguestplayer(withidentifier:).md)
- [guestIdentifier](gamekit/gkplayer/guestidentifier.md)

### Observing notifications

- [GKPlayerDidChangeNotificationName](foundation/nsnotification/name-swift.struct/gkplayerdidchangenotificationname.md)

### Loading player details

- [loadPlayers(forIdentifiers:withCompletionHandler:)](gamekit/gkplayer/loadplayers(foridentifiers:withcompletionhandler:).md)

## Relationships

### Inherits From

- [GKBasePlayer](gamekit/gkbaseplayer.md)

### Inherited By

- [GKLocalPlayer](gamekit/gklocalplayer.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Players

- [Connecting players with their friends in your game](gamekit/connecting-players-with-their-friends-in-your-game.md)
- [Saving the player’s game data to an iCloud account](gamekit/saving-the-player-s-game-data-to-an-icloud-account.md)
- [Protecting the player’s privacy using scoped identifiers](gamekit/protecting-the-player-s-privacy-using-scoped-identifiers.md)
- [GKLocalPlayer](gamekit/gklocalplayer.md)
- [GKBasePlayer](gamekit/gkbaseplayer.md)
- [GKLocalPlayerListener](gamekit/gklocalplayerlistener.md)
- [GKPlayerAuthenticationDidChangeNotificationName](foundation/nsnotification/name-swift.struct/gkplayerauthenticationdidchangenotificationname.md)
- [GKPlayerDidChangeNotificationName](foundation/nsnotification/name-swift.struct/gkplayerdidchangenotificationname.md)
