Contents

init(identifier:player:)

Initializes an achievement for a player.

Declaration

init(identifier: String, player: GKPlayer)

Parameters

  • identifier:

    The identifier for the achievement that you enter in App Store Connect.

  • player:

    The player who is earning the achievement.

Mentioned in

Return Value

An achievement for a player, or nil if an error occurs.

Discussion

Before creating an achievement, use the loadAchievements(completionHandler:) method to load the achievements that are in progress. If the achievement you want to report progress on isn’t in the array that GameKit passes to the handler, use this method to initialize the achievement, but only when reporting progress for a participant at the end of a turn-based match. Otherwise, use the init(identifier:) method to initialize the achievement.

See Also

Loading and Initializing Achievements