---
title: "setDefault(_:withCompletionHandler:)"
framework: gamekit
role: symbol
role_heading: Type Method
path: "gamekit/gkleaderboard/setdefault(_:withcompletionhandler:)"
---

# setDefault(_:withCompletionHandler:)

Sets the default leaderboard for the local player.

## Declaration

```swift
class func setDefault(_ leaderboardIdentifier: String?, withCompletionHandler completionHandler: (@Sendable ((any Error)?) -> Void)? = nil)
```

```swift
class func setDefault(_ leaderboardIdentifier: String?) async throws
```

## Parameters

- `leaderboardIdentifier`: The named leaderboard that is the new default leaderboard for the local player.
- `completionHandler`: A block to call after retrieving scores from the server. The block receives the following parameter:

## Discussion

Discussion GameKit uses the default leaderboard whenever your game uses a GKScore object to report a score to Game Center without explicitly setting the score object’s category property. You normally set the default leaderboard in App Store Connect. However, your game can use this class method to override the default leaderboard that appears for the local player. Game Center stores this information for each player. When you call this method, it creates a new background task to handle the request. The method then returns control to your game. When the task completes, GameKit calls your completion handler on the main thread. If an error occurs and it’s a network error, periodically resend the request until it completes.

## See Also

### Deprecated methods

- [loadCategories(completionHandler:)](gamekit/gkleaderboard/loadcategories(completionhandler:).md)
- [loadLeaderboards(completionHandler:)](gamekit/gkleaderboard/loadleaderboards(completionhandler:).md)
- [loadScores(completionHandler:)](gamekit/gkleaderboard/loadscores(completionhandler:).md)
