---
title: GKDialogController
framework: gamekit
role: symbol
role_heading: Class
path: gamekit/gkdialogcontroller
---

# GKDialogController

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

## Declaration

```swift
class GKDialogController
```

## Overview

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 object, as you would for an iOS game, specifying the state and setting its delegate. Then get the singleton dialog controller using the shared() class method, or initialize a new GKDialogController object. To present the dashboard, set the parentWindow property to the window that should display the dashboard and then call the present(_:) method, passing the GKGameCenterViewController object. 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(_:) delegate method. Implement this method to dismiss the shared dialog controller using the dismiss(_:) method. func gameCenterViewControllerDidFinish(_ gameCenterViewController: GKGameCenterViewController) {     // Dismiss the view controller.     let dialogController = GKDialogController.shared()     dialogController.dismiss(self) }

## Topics

### Accessing the Shared Dialog Controller

- [shared()](gamekit/gkdialogcontroller/shared().md)

### Setting the Presentation Window

- [parentWindow](gamekit/gkdialogcontroller/parentwindow.md)

### Presenting and Dismissing the Dialog

- [present(_:)](gamekit/gkdialogcontroller/present(_:).md)
- [dismiss(_:)](gamekit/gkdialogcontroller/dismiss(_:).md)

## Relationships

### Inherits From

- [NSResponder](appkit/nsresponder.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSStandardKeyBindingResponding](appkit/nsstandardkeybindingresponding.md)
- [NSTouchBarProvider](appkit/nstouchbarprovider.md)
- [NSUserActivityRestoring](appkit/nsuseractivityrestoring.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Game Center interfaces

- [Adding an access point to your game](gamekit/adding-an-access-point-to-your-game.md)
- [Displaying the Game Center dashboard](gamekit/displaying-the-game-center-dashboard.md)
- [GKAccessPoint](gamekit/gkaccesspoint.md)
- [GKViewController](gamekit/gkviewcontroller.md)
