Finding Squares for Advent of Code 2026 - Day 3

Date

I never made a visualization for Advent of Code in 2025. Nothing really compelled me to make one. This year I felt like I should bring it back, but a lot has changed since 2024.

Swift 6 and MainActor isolation got turned on, but that broke a lot of things. To keep things simple, I only ported my 2D renderer. This meant switching a lot of rendering code to @concurrent and fixing isolation issues around that.

One bonus is that the AVAssetWriter family of APIs got the async/await treatment, which removed a lot of locking and signals. CVReadOnlyPixelBuffer is an interesting new addition which required moving the drawing calls in to a closure, but this ultimately condensed my drawing calls from fetching pixel buffers, drawing, and submitting, down to just a single draw call. It’s all technically safer and hasn’t really caused any performance issues.


Day 3 of Advent of Code has you find squares of trees on a grid. The trick in part 2 is finding rotated squares, which I solved by just checking the slope between 2 points and then checking for the existence of 2 more points using the same or inverted slopes.

Finding Squares