<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKMatchmakerViewController/setHostedPlayer(_:didConnect:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKMatchmakerViewController(im)setHostedPlayer:didConnect:"
  },
  "title" : "setHostedPlayer(_:didConnect:)"
}
-->

# setHostedPlayer(_:didConnect:)

Updates the connection status of a player in a hosted game.

```
func setHostedPlayer(_ player: GKPlayer, didConnect connected: Bool)
```

## Parameters

`player`

The player whose status changed.

`connected`

A Boolean value that indicates whether the player connected or disconnected from the hosted match.

## Discussion

When you connect or disconnect a player from your server in a hosted game, use this method to update the player’s status that appears in the matchmaker view controllers on other player’s devices. For example, invoke this method after you connect a player from the [`matchmakerViewController(_:hostedPlayerDidAccept:)`](/documentation/GameKit/GKMatchmakerViewControllerDelegate/matchmakerViewController(_:hostedPlayerDidAccept:)) delegate method.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)