I've been playing around with the GameController framework, and have tried to get the charging state of a controller's battery. However, it doesn't seem to be available in the GCDeviceBattery type.
Does anyone know if getting the charging state is possible? Thanks!
Does anyone know if getting the charging state is possible? Thanks!
Hi,
once you got your controller connected, you can get the battery level like this:
once you got your controller connected, you can get the battery level like this:
Code Block swift @objc private func controllerDidConnect(notification: Notification) { guard let controller = notification.object as? GCController else { fatalError("Invalid notification object.") } var batteryLevel = Float(controller.battery?.batteryLevel ?? 0.0) }