Present GameCentre Overlay Programmatically

As GKGameCenterViewController has been deprecated, it seems that GKAccessPoint is now the correct way to present the GameCentre leaderboard.

But the placement options for the GKAccessPoint are very limited and lead to misaligned UI that looks clunky, as the GKAccessPoint does not align with the system navigation toolbar.

Am I missing something here or am I just stuck with a lopsided UI now?

I much preferred how this previously worked, where I could present the GKGameCenterViewController in a sheet from my own button

Hi BenRiceM,

I don't think you're missing anything...

GKAccessPoint was not designed with the intent of sitting in or alongside a UINavigationBar, primarily because the vast majority of games do not make use of UIKit for the user interfaces, instead building their own user interfaces that match with their games. The Game Center Welcome Banner and GKAccessPoint are designed to be "floating" over the top of game content and user interface.

Hopefully the screenshot at https://developer.apple.com/design/human-interface-guidelines/game-center#Integrating-the-access-point demonstrate this a little than I may have with words.

Obviously this is not ideal for your case where you're using UIKit and you want the buttons to align.

In this case the best recommendation I could give you right now is to build a custom UIBarButtonItem, which on tap calls one of the GKAccessPoint.trigger() APIs to present the dashboard.

You could then populate this button either either the player avatar from func loadPhoto(for size: GKPlayer.PhotoSize) async throws -> UIImage or an SFSymbol if you're deep linking into a particular screen of the dashboard (e.g. straight into your leaderboard). Apple News Puzzles already does something similar to this and making use of the GKAccessPoint.trigger(state: .leaderboards) API.

I appreciate this is extra work for yourself in this case, but it should leave you with an "access point" which is sized correctly for the navigation bar.

One small note I'd add is that this does mean highlights for your game would not be displayed, but I'm not sure how important that would be for your desired use case.

Present GameCentre Overlay Programmatically
 
 
Q