Weeknotes #1

Updating our book

I’d like to write more this year, so here’s an attempt at a proven format that’s new to me: a weekly log of the stuff I’ve worked on. New year, new format!

I started the week continuing to work on the update to our book Thinking in SwiftUI. We’ve basically rewritten it from scratch. We chose to do this not only because we understand SwiftUI better, but also because we learned so much through the workshops we’ve been organizing over the last few years. Working with small groups we get a lot of direct feedback and questions, and that has improved our explanations a lot.

Our current publishing setup generates two PDFs (one for screen, one for print) and an ePub. We input our own extended Markdown, convert this using a bunch of homegrown tooling, then generate Markdown as the output. This gets read by Pandoc, turned into LaTeX and finally into PDFs and ePub. The setup is a brittle, large, has many dependencies, takes a long time and is hard to debug or finetune for us.

Instead, we are now experimenting with generating attributed strings and rendering those using TextKit. This is much faster (less than a second versus minutes) and gives us a lot more control (we’re good at Swift and not good at LaTeX). This week, I worked on adding footnotes, roughly laying things out, highlighting code and adding figures and diagrams that are automatically generated using SwiftUI (here’s an example). To construct the attributed strings we came up with a result builder that lets us build them from different sources (Markdown, plain strings, SwiftUI, highlighted code, etc.). We’ll probably make some episodes about this or open-source this 1 .

I also worked on turning some of our interactive demos from the workshop into non-interactive diagrams for our book. Here’s an old version of one of those diagrams. We’ll probably turn this into a tree with numbers at the vertices and explanations in the text.

I read a bit about the new macro system in Swift. Very interesting stuff, but as of yet I understand very little about it. I’ll definitely look into this in more detail sometime soon.

I have only logged into Twitter maybe once this week, and basically moved to Mastodon. There’s a lot less activity, but also much less noise. I like it there.

At home, I had fun building a simple marble track out of scrap wood with the 4yo. In the house we’re renovating, I took down a wall and now we’re erecting a new wall (with a much larger door opening).

Over the holidays I made a ginger bug (which started to foam), but the ginger soda I tried making from it didn’t start carbonating. I’m not sure if it’s turning into vinegar or alcohol now, but it doesn’t taste right. To get better at fermentation, I bought The Art of Fermentation. I haven’t read too much yet, but at least the book is very well designed and I love the typography.


  1. Update we just released the first episode about this