---
title: "loadCategories(completionHandler:)"
framework: gamekit
role: symbol
role_heading: Type Method
path: "gamekit/gkleaderboard/loadcategories(completionhandler:)"
---

# loadCategories(completionHandler:)

Loads the list of leaderboard categories along with their corresponding localized titles.

## Declaration

```swift
class func loadCategories(completionHandler: (@Sendable ([String]?, [String]?, (any Error)?) -> Void)? = nil)
```

```swift
class func loadCategories() async throws -> ([String], [String])
```

## Parameters

- `completionHandler`: A block to call after retrieving the categories from the server. The block receives the following parameters:

## Discussion

Discussion You use this class method to retrieve the category identifiers and titles you configure for your leaderboards in App Store Connect. To create a leaderboard query that targets a particular category, set the category property to one of the strings that this method returns. 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 is complete, GameKit calls your completion handler on the main thread.

## See Also

### Deprecated methods

- [setDefault(_:withCompletionHandler:)](gamekit/gkleaderboard/setdefault(_:withcompletionhandler:).md)
- [loadLeaderboards(completionHandler:)](gamekit/gkleaderboard/loadleaderboards(completionhandler:).md)
- [loadScores(completionHandler:)](gamekit/gkleaderboard/loadscores(completionhandler:).md)
