Develop games where multiple players can play simultaneously.
This sample code project uses the GameKit framework to create a simple real-time game where players compete to tap faster than their opponent.
To create your own real-time game, replace the SwiftUI files with your gameplay interface, and modify the Game class to support your game.
To configure the sample code project, perform the following steps in Xcode:
- Change the Bundle Identifier to a unique ID on the Signing & Capabilities pane.
- Add your Apple ID account and assign the target to a team so Xcode can enable Game Center.
- Add an App Icon to the target.
- In App Store Connect, create an app record that matches the bundle ID (see Add a new app in App Store Connect Help).
- Connect two iOS devices to your Mac.
- If necessary, click Register Device in the Signing & Capabilities pane to create the provisioning profile.
- Build and run the sample on the two iOS devices.
- If the Welcome to Game Center sheet appears, sign in using a different Apple ID on each device.
Check out the documentation for more information: https://developer.apple.com/documentation/gamekit/finding_multiple_players_for_a_game