How Can I Detect New Day on watchOS While App Is Open

I'm currently working on my first watchOS app extension, which is based on Xcode's Multiplatform template. I'm looking for a solution that will allow me to detect a significant date change, such as the observation of midnight, when the watch app is open. However, I've been unable to find such a solution.

I'd like to avoid using Timers, if possible. But, the best solution that I have thought of thus far is to determine the number of seconds until midnight upon the app becoming active. Then, I could schedule a Timer to fire at that time, causing the UI to update. Upon the app becoming backgrounded, I would cancel the Timer. My hesitation with using timers is the impact on energy efficiency especially on a much smaller device.

I'm able to observe UIApplication.significantTimeChangeNotification (iOS) and Notification.Name.NSCalendarDayChanged (macOS), but I've not found a similar notification for watchOS. What I did find in the documentation for WKExtension are notifications that are similar to iOS app lifecycle notifications.

What I want is to update the UI of the watchOS app when it's open and a new day is observed, which UIApplication.significantTimeChangeNotification gets me on iOS. Is there a way for the watch app to observe a date change when the app is open on the watch?

References



How Can I Detect New Day on watchOS While App Is Open
 
 
Q