---
title: "remove(withIdentifier:completionHandler:)"
framework: gamekit
role: symbol
role_heading: Type Method
path: "gamekit/gkgamesession/remove(withidentifier:completionhandler:)"
---

# remove(withIdentifier:completionHandler:)

Removes the specified game session.

## Declaration

```swift
class func remove(withIdentifier identifier: String, completionHandler: @escaping @Sendable ((any Error)?) -> Void)
```

```swift
class func remove(withIdentifier identifier: String) async throws
```

## Parameters

- `identifier`: The unique string that identifies the game session to be removed.
- `completionHandler`: A block that is called after a game session has been removed from a container.

## Discussion

Discussion After the user has finished a game or decides to abandon a game, you must use this function to remove the game session from iCloud. Game sessions are not removed from iCloud automatically.

## 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)
- [loadSessions(inContainer:completionHandler:)](gamekit/gkgamesession/loadsessions(incontainer:completionhandler:).md)
