Class

GKAchievementDescription

An object holding text and images used to describe an achievement for an app.

Overview

When you develop your game, you create localized achievement descriptions in iTunes Connect. At runtime, your game retrieves these descriptions from Game Center. Usually your game downloads the achievement descriptions when it wants to present a custom achievement user interface to the player.

To retrieve a set of achievement description objects for your game, call the loadAchievementDescriptions(completionHandler:) class method. For performance reasons, achievement images are downloaded separately. To download am achievement description’s completion image, call that object’s loadImage(completionHandler:) method.

The incompleteAchievementImage() and placeholderCompletedAchievementImage() class methods provide standard images your game can use to present achievement progress to the player.

Topics

Retrieving Achievement Descriptions

Reading and Writing Achievement Properties

var identifier: String?

A unique string used to identify the achievement.

var title: String?

A localized title for the achievement.

var unachievedDescription: String?

A localized description of the achievement to be used when the local player has not completed the achievement.

var achievedDescription: String?

A localized description to be used after the local player has completed the achievement.

var maximumPoints: Int

The number of points the player earns by completing this achievement.

var image: NSImage?

An image to display for the completed achievement.

var isHidden: Bool

A Boolean value that states whether this achievement is initially visible to players.

var isReplayable: Bool

A Boolean value that states whether this achievement can be earned multiple times.

Working with Achievement Images

class func incompleteAchievementImage()

A common image for incomplete achievements.

class func placeholderCompletedAchievementImage()

A common image for completed achievements.

func loadImage(completionHandler: ((UIImage?, Error?) -> Void)? = nil)

Loads the image property for a completed achievement.

Retrieving Group Information

var groupIdentifier: String?

The identifier for the group the achievement description is part of.

Relationships

Inherits From

See Also

Achievements

class GKAchievement

An object that communicates with Game Center about the local player’s progress towards completing an achievement.