How to check the battery level of your iOS device?

We can use the batteryLevel property of the UIDevice class for this. It will return a float:

If you’d like to print this in a UILabel you’ll have to convert it into a String Object like so:

For this to work battery monitoring needs to be enabled, perhaps in the viewDidLoad method. Otherwise the returned value will be -1.0:

About Jay Versluis

Jay is a medical miracle known as a Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

Add your voice!