Instance Method

loadImage(completionHandler:)

The image associated with the default leaderboard.

Declaration

iOS, Mac Catalyst
func loadImage(completionHandler: ((UIImage?, Error?) -> Void)? = nil)
macOS
func loadImage(completionHandler: ((NSImage?, Error?) -> Void)? = nil)

Parameters

completionHandler

A block to be called after the scores are retrieved from the server.

The block receives the following parameters:

image

Contains the image associated with the leaderboard.

error

If an error occurred, this error object describes the error. If the operation was completed successfully, the value is nil.

Discussion

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your completion handler. The completion handler is always called on the main thread.

See Also

Customizing the Leaderboard Request

var playerScope: GKLeaderboard.PlayerScope

A filter used to restrict the search to a subset of the players on Game Center.

enum GKLeaderboard.PlayerScope

The scope of players to be searched for scores.

var range: NSRange

The numerical score rankings to return from the search.

var timeScope: GKLeaderboard.TimeScope

A filter used to restrict the search to scores that were posted within a specific period of time.

enum GKLeaderboard.TimeScope

The period of time to which a player’s best score is restricted.

var identifier: String?

The named leaderboard to retrieve information from.