Weeknotes 2025-W35 [2025-W35]
- September 1, 2025
- Jon Sterling
Weeknotes 2025-W35 [2025-W35]
- September 1, 2025
- Jon Sterling
NewsRadar: AppKit, SQLite, etc. [01GA]
- September 1, 2025
- Jon Sterling
NewsRadar: AppKit, SQLite, etc. [01GA]
- September 1, 2025
- Jon Sterling
Over the weekend I continued my very slow development of NewsRadar. When I started my AppKit rewrite, I had initially chosen to use Marco Arment’s Blackbird Swift library for SQLite. This is a pretty nice library (and it does automatic database migrations), but it makes a lot of assumptions about how your database is set up and it is not so easy to make non-trivial queries without dropping down to raw SQL. I decided to try switching to the more fully featured GRDB.swift library; this is a lot more extensive, but requires a lot more setup on my end, including setting up migrations; but on the bright side, it does provide the needed infrastructure to cleanly ensure that migrations are run exactly once, etc.
I’ve written some code to compile logical queries (trees built from AND/OR/NOT and certain atomic predicates on posts and feeds) into SQL queries. Any individual one of these queries is not so hard to write, but actually translating the general case is kind of complicated; lots of joins and so on are needed in the atomic cases. I’ve settled on an approach involving assigning to intermediate nodes a named common table expression, which I may revisit in the future once I’ve had a chance to run this on some actual data. (If anyone has some better prior art on such a query compiler, let me know! I’m somewhat new to SQL databases.)
I had previously written a pretty cool structural query editor in SwiftUI. I am going to take the opportunity to reconsider the design a bit now since I have to translate it to AppKit anyway.
I got my hands on a copy of David Chisnall’s amazing Cocoa Programming Developer’s Handbook, which is just as relevant today as it was in 2009. Chisnall is a fantastic technical writer, and this book displays a much deeper understanding and insight than one typically gets in a programming book. I wish people still wrote books like this…