Instance Property

batteryLevel

The battery charge level for the device.

Declaration

var batteryLevel: Float { get }

Discussion

Battery level ranges from 0.0 (fully discharged) to 1.0 (100% charged). Before accessing this property, ensure that battery monitoring is enabled.

If battery monitoring is not enabled, battery state is unknown and the value of this property is –1.0.

See Also

Getting the Device Battery State

var isBatteryMonitoringEnabled: Bool

A Boolean value indicating whether battery monitoring is enabled (true) or not (false).

var batteryState: UIDeviceBatteryState

The battery state for the device.