---
title: "loadSessions(inContainer:completionHandler:)"
framework: gamekit
role: symbol
role_heading: Type Method
path: "gamekit/gkgamesession/loadsessions(incontainer:completionhandler:)"
---

# loadSessions(inContainer:completionHandler:)

Retrieves all of the game sessions associated with a container.

## Declaration

```swift
class func loadSessions(inContainer containerName: String?, completionHandler: @escaping @Sendable ([GKGameSession]?, (any Error)?) -> Void)
```

```swift
class func loadSessions(inContainer containerName: String?) async throws -> [GKGameSession]
```

## Parameters

- `containerName`: A unique string that identifies the container to be accessed.
- `completionHandler`: A block that is called after all the game sessions have been loaded.

## See Also

### Creating and Loading Game Sessions

- [createSession(inContainer:withTitle:maxConnectedPlayers:completionHandler:)](gamekit/gkgamesession/createsession(incontainer:withtitle:maxconnectedplayers:completionhandler:).md)
- [load(withIdentifier:completionHandler:)](gamekit/gkgamesession/load(withidentifier:completionhandler:).md)
- [remove(withIdentifier:completionHandler:)](gamekit/gkgamesession/remove(withidentifier:completionhandler:).md)
