loadEntries(for:timeScope:completionHandler:)
Returns the scores for the local player and other players for the specified time period.
Declaration
func loadEntries(for players: [GKPlayer], timeScope: GKLeaderboard.TimeScope, completionHandler: @escaping @Sendable (GKLeaderboard.Entry?, [GKLeaderboard.Entry]?, (any Error)?) -> Void)func loadEntries(for players: [GKPlayer], timeScope: GKLeaderboard.TimeScope) async throws -> (GKLeaderboard.Entry?, [GKLeaderboard.Entry])Parameters
- players:
The players whose scores this method returns.
- timeScope:
Specifies the time period for the scores. This parameter is applicable to nonrecurring leaderboards only. For recurring leaderboards, pass Alltime for this parameter.
- completionHandler:
A block that GameKit calls when this method loads the scores.
The block receives the following parameters:
- localPlayerEntry
The score for the local player, or
nilif the player has no score.- entries
The scores for the players during the specified time period, including the local player’s score if it exists.
- error
Describes an error if it occurs, or
nilif the operation completes.