Instance Method

loadImage(completionHandler:)

Load the image associated with the leaderboard set.

Declaration

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

Parameters

completionHandler

A block that is called when the categories have been retrieved from the server.

The block receives the following parameters:

image

The image associated with the leaderboard set. If an error occurred, this value will be non-nil. In this case, the array holds whatever data Game Kit was able to download before the error occurred.

error

If an error occurred, this error object describes the error. If the operation 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

Loading the Leaderboard Sets

func loadLeaderboards(completionHandler: (([GKLeaderboard]?, Error?) -> Void)?)

Load all of the leaderboards for the current leaderboard set.

var title: String

Localized title for the leaderboard set.

var identifier: String?

The identifier for the leaderboard set.

var groupIdentifier: String?

Identifies the group that the leaderboard set belongs to.