'GameCenter circle user icon always in upper right corner, how to hide or place somewhere else on screen?
I have a super simple app where I am trying to test GameCenter, most of the code is below:
import SwiftUI
import GameKit
struct ContentView: View {
@State var gameCenterUtility = GameCenterUtility()
let localPlayer = GKLocalPlayer.local
var body: some View {
NavigationView {
NavigationLink(destination: TestView()) {
Text("Play Game")
}
}
.navigationViewStyle(StackNavigationViewStyle())
.onAppear {
gameCenterUtility.authenticateUser()
}
}
}
class GameCenterUtility {
func authenticateUser() {
let localPlayer = GKLocalPlayer.local
localPlayer.authenticateHandler = { vc, error in
guard error == nil else {
print(error?.localizedDescription ?? "")
return
}
GKAccessPoint.shared.isActive = localPlayer.isAuthenticated
}
}
}
The challenge I am having is that as you can see below, the circle icon of the user's profile (Giant B) is always displaying in the top-right corner of the screen, hiding anything that's behind it.

Is there a way to hide that image circle or move it elsewhere in the app? Nothing in my code tells it to appear in the top right corner of the screen.
Here's the code of the TestView:
import SwiftUI
struct TestView: View {
var body: some View {
Text("Hello, World or not!")
}
}
Solution 1:[1]
yes you can set the location of the access point like this
GKAccessPoint.shared.location = .topLeading
and show/hide it using the isActive boolean flag you're already using
GKAccessPoint.shared.isActive = false
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Fault |
