Type Property

UIDeviceBatteryLevelDidChange

Posted when the battery level changes.

Declaration

static let UIDeviceBatteryLevelDidChange: NSNotification.Name

Discussion

For this notification to be sent, you must set the isBatteryMonitoringEnabled property to true.

Notifications for battery level change are sent no more frequently than once per minute. Do not attempt to calculate battery drainage rate or battery time remaining; drainage rate can change frequently depending on built-in applications as well as your application.

You can obtain the battery level by getting the value of the batteryLevel property.

See Also

Notifications

static let UIDeviceOrientationDidChange: NSNotification.Name

Posted when the orientation of the device changes.

static let UIDeviceProximityStateDidChange: NSNotification.Name

Posted when the state of the proximity sensor changes.