batteryLevelDidChangeNotification
A notification that posts when the battery level changes.
Declaration
nonisolated class let batteryLevelDidChangeNotification: NSNotification.NameMentioned in
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. Don’t 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.