in swiftUI & tvOS 15, when calling the GCController.controllers() to get the list of controllers connected to the apple tv,
import GameController
...
let siriRemoteAsGameController = GCController.controllers().first
the Siri Remote is not registered as the first controller, in fact it is not registered at all ! up until tvOS 15 (14.7 for example) it was working even if i register for notification the connect event isn't dispatched for the already connected Siri remote
NotificationCenter.default.addObserver(forName: .GCControllerDidConnect, object: nil, queue: .main) { note in
print("GCControllerDidConnect")
if let detectedGCController = note.object as? GCController {
print("Controller Detected")
}
}
GCController.startWirelessControllerDiscovery(completionHandler: {})
i cannot find a change in that area according to Appel's $#itty documentation
any help would be appreciated
As a very simple test, I tried this:
struct ContentView: View {
var body: some View {
Button("Query controllers") {
print("controllers: \(GCController.controllers())")
}
}
}
The first time I clicked "Query controllers", it returned:
controllers: []
Clicking "Query controllers" again, it returned the siri remote:
controllers: [<GCController 0x283618620 ('Siri Remote (2nd Generation)' - 0xa6f1756e8a7cb7bb)>]
So perhaps you have to have some controller interaction, to populate GCController.controllers()?
tvOS 15.0
Xcode 13.0