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 -> UIImagefunc loadImage(completionHandler: (@Sendable (NSImage?, (any Error)?) -> Void)? = nil)func loadImage() async throws -> NSImageParameters
- completionHandler:
A block that GameKit calls when this method completes the download.
The block receives the following parameters:
imageThe image that represents the completed achievement. This parameter is
nilif an error occurs.errorDescribes an error if it occurs, or
nilif 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.