Wasted Time’s Latest Rewrite

As is my habit each summer after WWDC, I rewrite my Wasted Time app to try and take advantage of the latest changes for iOS, macOS, tvOS, and watchOS. This summer has been no difference; however, I also took some time to completely refactor the application to no longer use the AppDelegate feature of older swift programming models. This change was the most dramatic and is still causing me a few problems.

In prior years, the AppDelegate required that I had a different set of code to handle launching on watchOS verses macOS and iOS. I also ended up with lots of compiler directives in order to handle the fact that on watchOS the delegate was a different type than on iOS. This level of #if os(watchOS), really caused a lot of crud in the code. Getting rid of that and using the @State variables, injecting them into the .environment has made things a lot cleaner. It also has helped me fix a lot of long running bugs in my statistics page.

Another challenge I hope to resolve over the course of the year, is removal of @UIApplicationMain and full conversion to @Main in all versions of the app. While I don’t fully have this one worked out in my mind, it is a necessity since my macOS and iPadOS version have broken their keyboard handling. The keyboard was using App Intents, which I have also messed up this summer, and I am sure solving this problem will provide me with improved capabilities for my Widgets.

My widget code has been completely rewritten due to changing over to WidgetKit. I am hoping to make an interactive widget and Live Activity over the course of this year. If I can pull that off I may actually change the version major this year twice!

In the meantime, the investment over the last few years on SwiftUI, along with this summers change to @Main has allowed me to easily create a native VisionOS version of the app. I can’t wait to get my hands on a VisionPro to test it out; but I assume I will not have the opportunity to do so before Apple launches the device early next year.