---
title: "players(with:)"
framework: gamekit
role: symbol
role_heading: Instance Method
path: "gamekit/gkgamesession/players(with:)"
---

# players(with:)

Retrieves a list of players with the specified connection state.

## Declaration

```swift
func players(with state: GKConnectionState) -> [GKCloudPlayer]
```

## Parameters

- `state`: A GKConnectionState used to find the requested players.

## Return Value

Return Value An array of players with the indicated connection state.

## See Also

### Connecting Players for Real-Time Communication

- [setConnectionState(_:completionHandler:)](gamekit/gkgamesession/setconnectionstate(_:completionhandler:).md)
- [send(_:with:completionHandler:)](gamekit/gkgamesession/send(_:with:completionhandler:).md)
- [GKTransportType](gamekit/gktransporttype.md)
