You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Match making for a live match can be initiated via the **GKMatchMakerView**.
73
98
@@ -92,8 +117,7 @@ struct ContentView: View {
92
117
}
93
118
```
94
119
95
-
96
-
### GameKit TurnBasedMatchmaker
120
+
#### GameKit TurnBasedMatchmaker
97
121
98
122
To start a turn based match use **GKTurnBasedMatchmakerView**.
99
123
@@ -118,6 +142,75 @@ struct ContentView: View {
118
142
}
119
143
```
120
144
145
+
### GameKit Manager
146
+
147
+
#### GKMatchManager
148
+
149
+
GameKitUI views rely on a manager singelton **GKMatchManager**, which listens to GameKit state changes of the match making process.
150
+
Changes to the local player **GKLocalPlayer**, invites **GKInvite** or matches **GKMatch** can be observed using the provided public subjects **CurrentValueSubject**.
The provided **GKMatchMaker** example, includes a full working SwiftUI solution for handling GameKit matchmaking.
199
+
Just copy the file **Config.xcconfig-example** to **Config.xcconfig** and add your development team ID for the variable **XCCONFIG_DEVELOPMENT_TEAM** and a valid Bundle ID with GameCenter support for **XCCONFIG_BUNDLE_ID**.
200
+
The **Config.xcconfig** should now look something like this:
201
+
202
+
```config
203
+
// Configuration settings file format documentation can be found at:
204
+
// https://help.apple.com/xcode/#/dev745c5c974
205
+
206
+
XCCONFIG_DEVELOPMENT_TEAM = 9988XX7D42 // YOUR DEVELOPMENT TEAM ID
207
+
XCCONFIG_BUNDLE_ID = domain.host.application // A BUNDLE ID WITH SUPPORT FOR THE GAMECENTER CAPABILITY e.g. domain.host.application
208
+
```
209
+
210
+
211
+
Then open the **GKMatchMaker.xcodeproj** and run it on as many **real hardware** devices to test the GameKit match making.
+[raywenderlich.com: Game Center for iOS: Building a Turn-Based Game](https://www.raywenderlich.com/7544-game-center-for-ios-building-a-turn-based-game)
0 commit comments