After frustrations and incantations trying to invoke Cthulhu to visit some horrible fate to SwiftUI, I managed to get past some of the hurdles of coding for the Apple ecosystem.
Back six or seven years ago, when I first coded an app for a macOS, then called Mac OS X, I used Objective-C, and it really had built in every supporting API and function you’d need to code any application for a Mac. I was a C programmer for the longest time, with a lot of exposure to C++ as well, so learning Objective-C was straightforward. There was of course a learning curve to be had, but that curve was not as steep as the current one with SwiftUI.
Maybe Apple is still building SwiftUI, adding with each version. Or maybe I just don’t get it. Maybe I’m too old to see the goodness of this type of approach to programming.
SwiftUI feels half-baked. An afterthought. I’m reverting to having to create hacks to solve things that, for a language that is supposed to help you create user interfaces and interact with them, doesn’t have most of them. Things like detecting when an app is idle, or, in the case of macOS, when a user wants to save files in a directory of his/her choosing, or creating buttons with a specific function often call for hacky code that is not only long and difficult to understand due to the terseness of Swift to begin with, but make Swift revert to having to use some of the old Objective-C API calls. So, what’s the point?
Anyway, I don’t want to go into a rant.
I solved some of the issues I was having with the sandboxed nature of macOS apps and how to access and save plain text files outside the application default directory. It was not easy, however it taught me a few things that I will need for the second part of coding this app: now that I have the main UI coded and working, the next stage is the search function. A whole different world of pain. First I need to polish how I save and work with the data itself, making sure the app can remain lightweight and fast.
Here are the next steps:
- Finalize reading data from files - focus on optimization of memory/disk use
- Provide a way to export data to files so I can export all the data already in the app
- Finish coding the search function
- Code the proper navigation on the app via keyboard, so I can use it without the mouse
- Finish the preferences and settings window
I'm dreading (4) since, as of this current version of SwiftUI, anything that has to do with focus or jumping in between UI elements with the Tab key is completely impossible.
Let's bring the pain!
Oh, in case you were wondering, these are the design rules I set for this application.