After spending the first two weeks of the beta period to get a foundation going, I was eager to start working on the actual watch app.
This was right about the time when Beta 2 hit, so first I’ve upgraded to that and then started with the Watch project.
Building the UI
Eager to play around with SwiftUI, the first thing I have done was to actually just create a skeleton UI:
What immediately sprang to my mind as I was working on this was the fact that the built-in preview feature of SwiftUI forces you to keep your views self-contained and to keep the dependencies small and to keep your data easily mockable.
Otherwise you will suddenly be in the position where your Xcode preview requires working network connections and a lot of application state.
I’ve also learned that Beta 2 was still on very shaky grounds before running the actual code even once: My attempts to display a map view caused Xcode to crash completely the moment it tried to paint the UI preview, so I’ve stubbed that out to just be a rectangle
But overall, designing (if you can call it that) the skeleton UI went very quickly (a matter of a few hours) and I was eager to hook everything up.
A hard stop
After working on the UI, the next step was to produce a backend that orchestrates the actual application state. This single class is the only thing that keeps track of state in the application and based on which the UI decides what to paint and how and where the UI will call into in order to change the overall state (for example when the user logs in or when they start a booking)
This is what (at the time) you would use
My next step, thus, was to create what I called the
ApplicationStateHandler which I had implement the
That handler itself would expose a
state property which could have one of various values of an
enum. The main SwiftUI view would basically be a huge
select statement over that state property and then decide what actual view to render based on the state.
This was my plan, but no matter what I did, the moment I had
ApplicationStateHandler implement the
BindableObject protocol, I would put Xcode 11 Beta 2 in a state where it was using 100% of each of my 8 CPU cores while trying to compile my code.
So in the end, I wasn’t stopped by incomprehensible error messages (I got my share of those too), but by a compilation run that did not seem to want to complete in finite time.
Instead of solving the halting problem, I decided to wait another two weeks because I already had other non-project related things on my plate.
Stay tuned for next time to see what stopped me hard in Beta 3