loadPhoto(for:withCompletionHandler:)
Loads a photo of the player from Game Center.
Declaration
func loadPhoto(for size: GKPlayer.PhotoSize, withCompletionHandler completionHandler: (@Sendable (UIImage?, (any Error)?) -> Void)? = nil)func loadPhoto(for size: GKPlayer.PhotoSize) async throws -> UIImagefunc loadPhoto(for size: GKPlayer.PhotoSize, withCompletionHandler completionHandler: (@Sendable (NSImage?, (any Error)?) -> Void)? = nil)func loadPhoto(for size: GKPlayer.PhotoSize) async throws -> NSImageParameters
- 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:
- photo
An image of the player. If an error occurs, this may be a cached image already on the device; otherwise, it is
nil.- error
Describes an error if it occurs, or
nilif the operation completes.
Mentioned in
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.