So here's my situation, I have a little app that will keep track of how long you have been working and let you know when it's time to take a break. I have an NSTimer that fires every second and updates some numbers (the remaining time). The app lives in the status bar, and I want the remaining time to be show in a menu item from the status menu dropdown menu. Right now I have it Updating to an NSMenuItem and it works but when you click on the icon in the menu bar to get at the menu, the time won't update dynamically while you're looking at it. If you change focus and then go back to the menu, the time has kept correctly, but again, when the menu is open it doesn't update.
Is there anyway I can get that MenuItem to update even while the menu is open in swift? There are several other threads with objective C solutions but I haven't been able to adapt them for swift.
You have to add your Timer to NSRunLoop.
NSRunLoop.currentRunLoop().addTimer(yourTimer, forMode: NSRunLoopCommonModes)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With