---
title: "loadPhoto(for:withCompletionHandler:)"
framework: gamekit
role: symbol
role_heading: Instance Method
path: "gamekit/gkplayer/loadphoto(for:withcompletionhandler:)"
---

# loadPhoto(for:withCompletionHandler:)

Loads a photo of the player from Game Center.

## Declaration

```swift
func loadPhoto(for size: GKPlayer.PhotoSize, withCompletionHandler completionHandler: (@Sendable (UIImage?, (any Error)?) -> Void)? = nil)
```

```swift
func loadPhoto(for size: GKPlayer.PhotoSize) async throws -> UIImage
```

```swift
func loadPhoto(for size: GKPlayer.PhotoSize, withCompletionHandler completionHandler: (@Sendable (NSImage?, (any Error)?) -> Void)? = nil)
```

```swift
func loadPhoto(for size: GKPlayer.PhotoSize) async throws -> NSImage
```

## Parameters

- `size`: A constant that determines the size of the photo to load.
- `completionHandler`: The block that GameKit calls when it completes the request. The block receives the following parameters:

## Mentioned in

Starting turn-based matches and passing turns between players

## Discussion

Discussion The size of the image that returns to your game is dependent on both the size parameter and the user interface idiom of the device your game is running on.

## See Also

### Loading player photos

- [GKPlayer.PhotoSize](gamekit/gkplayer/photosize.md)
