Weeknotes № 5-7

Launched

Over the last few weeks I worked with a strong focus and did not take the time to write weeknotes. The SwiftUI Field Guide is now live. I’ll try to blog a bit more about the why and how in the upcoming weeks. It felt a bit like preparing for a marathon: I worked hard at it almost every single day (often also evenings, after the kids went to bed) for multiple months. In the days before the launch, I wanted to get everything as perfect as I could (there were still some pretty embarassing bugs just before the launch). The day after launching it, I felt happy but absolutely exhausted.

It’s been a real pleasure building this. The design was all done by Nick who also really obsessed over getting this right. I did the rest. There are so many fun little details in there: the site changes color when you’re in dark mode (and the “SwiftUI” colors change, too). The code is formatted using a pretty printer, making it responsive on mobile (this isn’t perfect, but in most examples it is better than doing nothing). The more complex animations are done in “SwiftUI”.

In my first prototype, I rendered everything using a flat canvas view. This worked well, but I realized at some point that I wanted more interactive elements such as scroll views and buttons. I didn’t really want to implement an entire scroll view myself. At some point, I switched to building up a DOM tree so that I could use the browser’s built-in scrolling (which in turn uses the platform’s built-in scrolling). Some views are still rendered using canvas (text and advanced shapes) where others use native DOM elements (a filled rounded rectangle, for example, is just a div with a background color and border radius).

I really wanted to make everything work as close as possible to real SwiftUI as I could. Essentially, anything that lays out differently I consider a bug. Hopefully I can fix some of the remaining bugs very soon.

In other news, I have been ramping up my marathon training again, and started a new schedule to (hopefully) run a marathon in late April. I typically prepare using at least a 16 week schedule, but due to illness at the beginning of the year I only have 12 weeks. I don’t want to run even later (in May) because I run much better when it’s cooler. I decided to use this marathon as a stepping stone to getting fit again. Clearly, there is no room for getting sick again — if COVID or something else happens I will have to set a different goal.