<!--
{
  "availability" : [
    "iOS: 17.0.0 - 26.0.0",
    "iPadOS: 17.0.0 - 26.0.0",
    "macCatalyst: 17.0.0 - 26.0.0",
    "macOS: 14.0.0 - 26.0.0",
    "tvOS: 17.0.0 - 26.0.0",
    "visionOS: 1.0.0 - 26.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKLeaderboard/Entry/challengeComposeController(withMessage:players:completion:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKLeaderboardEntry(im)challengeComposeControllerWithMessage:players:completion:"
  },
  "title" : "challengeComposeController(withMessage:players:completion:)"
}
-->

# challengeComposeController(withMessage:players:completion:)

Provides a challenge compose view controller with preselected player identifiers and a preformatted, player-editable message.

```
func challengeComposeController(withMessage message: String?, players: [GKPlayer]?, completion completionHandler: GKChallengeComposeHandler? = nil) -> UIViewController
```

## Parameters

`message`

The preformatted, player-editable message that GameKit sends to the players in the challenge.

`players`

The players to invite to the challenge.

`completionHandler`

A block that GameKit calls after it displays the view controller.

## Return Value

A <doc://com.apple.documentation/documentation/UIKit/UIViewController> containing the player identifiers and a player-editable message.

## Discussion

GameKit presents the returned view controller modally on the top view controller. After GameKit displays the view controller and the player sends or cancels the challenge, GameKit calls the completion handler block on the main thread.

---

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)