<!--
{
  "availability" : [
    "macOS: 10.8.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKDialogController",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKDialogController"
  },
  "title" : "GKDialogController"
}
-->

# GKDialogController

An object that provides the ability to present the dashboard in macOS games.

```
class GKDialogController
```

## Overview

For macOS games, use a `GKDialogController` object to present the dashboard from which players can browse and manage their Game Center data.

Initialize a new [`GKGameCenterViewController`](/documentation/GameKit/GKGameCenterViewController) object, as you would for an iOS game, specifying the state and setting its delegate. Then get the singleton dialog controller using the [`shared()`](/documentation/GameKit/GKDialogController/shared()) class method, or initialize a new `GKDialogController` object.

To present the dashboard, set the [`parentWindow`](/documentation/GameKit/GKDialogController/parentWindow) property to the window that should display the dashboard and then call the [`present(_:)`](/documentation/GameKit/GKDialogController/present(_:)) method, passing the `GKGameCenterViewController` object.

```swift
func presentAchievement() {
    let viewController = GKGameCenterViewController(achievementID: "101")
    viewController.gameCenterDelegate = self
    
    let dialogController = GKDialogController.shared()
    dialogController.parentWindow = NSApplication.shared.mainWindow
    dialogController.present(viewController)
}
```

When the player closes the dashboard, GameKit calls the [`gameCenterViewControllerDidFinish(_:)`](/documentation/GameKit/GKGameCenterControllerDelegate/gameCenterViewControllerDidFinish(_:)) delegate method. Implement this method to dismiss the shared dialog controller using the [`dismiss(_:)`](/documentation/GameKit/GKDialogController/dismiss(_:)) method.

```swift
func gameCenterViewControllerDidFinish(_ gameCenterViewController: GKGameCenterViewController) {
    // Dismiss the view controller.
    let dialogController = GKDialogController.shared()
    dialogController.dismiss(self)
}
```

## Topics

### Accessing the Shared Dialog Controller

[`shared()`](/documentation/GameKit/GKDialogController/shared())

Retrieves the shared instance of the dialog controller.

### Setting the Presentation Window

[`parentWindow`](/documentation/GameKit/GKDialogController/parentWindow)

The window that displays the dashboard.

### Presenting and Dismissing the Dialog

[`present(_:)`](/documentation/GameKit/GKDialogController/present(_:))

Presents the dashboard in the window.

[`dismiss(_:)`](/documentation/GameKit/GKDialogController/dismiss(_:))

Dismisses the dashboard.



---

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)