Contents

loadImage(completionHandler:)

Loads the image to display when the player completes the achievement.

Declaration

func loadImage(completionHandler: (@Sendable (UIImage?, (any Error)?) -> Void)? = nil)
func loadImage() async throws -> UIImage
func loadImage(completionHandler: (@Sendable (NSImage?, (any Error)?) -> Void)? = nil)
func loadImage() async throws -> NSImage

Parameters

  • completionHandler:

    A block that GameKit calls when this method completes the download.

    The block receives the following parameters:

    image

    The image that represents the completed achievement. This parameter is nil if an error occurs.

    error

    Describes an error if it occurs, or nil if the operation completes.

Mentioned in

Discussion

First, use the loadAchievementDescriptions(completionHandler:) method to download the achievement description objects, and then use this method to download the individual achievement images. While GameKit downloads an achievement image, you can display the placeholder image. If successful, GameKit sets the image property to the image it passes to the completion handler.

See Also

Working with Achievement Images