---
title: "loadEntries(for:timeScope:range:completionHandler:)"
framework: gamekit
role: symbol
role_heading: Instance Method
path: "gamekit/gkleaderboard/loadentries(for:timescope:range:completionhandler:)"
---

# loadEntries(for:timeScope:range:completionHandler:)

Returns the scores for the local player and other players for the specified type of player, time period, and ranks.

## Declaration

```swift
func loadEntries(for playerScope: GKLeaderboard.PlayerScope, timeScope: GKLeaderboard.TimeScope, range: NSRange, completionHandler: @escaping @Sendable (GKLeaderboard.Entry?, [GKLeaderboard.Entry]?, Int, (any Error)?) -> Void)
```

```swift
func loadEntries(for playerScope: GKLeaderboard.PlayerScope, timeScope: GKLeaderboard.TimeScope, range: NSRange) async throws -> (GKLeaderboard.Entry?, [GKLeaderboard.Entry], Int)
```

## Parameters

- `playerScope`: Specifies whether to get scores from friends or all players.
- `timeScope`: Specifies the time period for the scores. This parameter is applicable to nonrecurring leaderboards only. For recurring leaderboards, pass doc://com.apple.gamekit/documentation/GameKit/GKLeaderboard/TimeScope-swift.enum/allTime for this parameter.
- `range`: Specifies the range of ranks to use for getting the scores. The difference between the minimum rank and maximum rank must not exceed 100.
- `completionHandler`: A block that GameKit calls when this method completes the request. The block receives the following parameters:

## Mentioned in

Encourage progress and competition with leaderboards

## Discussion

Discussion GameKit uses the following algorithm to fetch GKLeaderboard scores: Begins with the set of all possible scores for the leaderboard. Discards any scores that don’t match the playerScope and timeScope properties. For each player, keeps the best score that player earns and discards the rest. Sorts the scores from best to worst. Uses the range property to determine which scores return.

## See Also

### Loading Scores

- [loadEntries(for:timeScope:completionHandler:)](gamekit/gkleaderboard/loadentries(for:timescope:completionhandler:).md)
- [GKLeaderboard.PlayerScope](gamekit/gkleaderboard/playerscope-swift.enum.md)
- [GKLeaderboard.TimeScope](gamekit/gkleaderboard/timescope-swift.enum.md)
- [GKLeaderboard.Entry](gamekit/gkleaderboard/entry.md)
