Contents

report(_:withCompletionHandler:)

Reports the player’s progress of players toward one or more achievements.

Declaration

class func report(_ achievements: [GKAchievement], withCompletionHandler completionHandler: (@Sendable ((any Error)?) -> Void)? = nil)
class func report(_ achievements: [GKAchievement]) async throws

Parameters

  • achievements:

    The achievements that you’re reporting to Game Center.

  • completionHandler:

    A block that GameKit calls when the operation completes.

    The block receives the following parameter:

    error

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

Mentioned in

Discussion

Call this method to communicate to Game Center about the local player’s progress towards completing one or more achievements.

Game Center only updates the achievement’s percentComplete and lastReportedDate properties if the percentComplete property of an achievement that you pass to this method is greater than the current value. If the achievement is hidden, Game Center also makes it visible. If the percentComplete property is 100.0, Game Center sets its isCompleted property to true and may show a banner to the player.

For efficiency, include multiple achievements rather than invoking this method separately for each achievement. Since Game Center associates an achievement with the local player at the time you create the achievement, only invoke this method after you initialize the same player on the device.

See Also

Reporting Progress on Achievements