I'm trying to make a status bar app that reminds me when my mac has reached a charge of 100%. I need to keep updating the charging variable so that I can know when to send the notification. All the while loops fail to display my icon on the status bar, and whenever I hover over the empty space it creates, the rainbow spinning wheel is displayed.
I tried to use didset but it doesn't show a notification at all.
Note: The problem is not with the notification or the getbatterystate, I've used a simple print in place of the notification function and nothing displayed either. For the getbatterystate I've printed it, and an integer did show up
var charge: Int = Int(getBatteryState())!{
didSet{
if charge == 40{
showNotification()
}else{
showNotification()
charge = Int(getBatteryState())!
}
}
}