TL;DR Yes, I rewrote Partout from Swift to Zig with AI. No, it wasn’t one prompt.
In late 2024, I started venting the idea of making Passepartout available beyond the Apple platforms, and this blog testifies how much I dedicated myself to making the original Swift/ObjC codebase cross-platform for more than a year.
Cross-platform Swift
Around March 2025, I evaluated a few options that made sense at the time, and I ended up sticking with Swift because:
- I was extremely proficient in Swift.
- Partout was already agnostic of platforms and crypto.
- The VPN code was stable and battle-tested.
- Ports always regress to a degree, and I didn’t want to waste more time refactoring.
Last but not least, there were no comparable examples of Swift used in low-level, cross-platform libraries at that scale (only later did I realize why). This was the main non-technical drive: trying something new.
Months later, I started thinking that Swift wasn’t a great bet for portable software, and that I was only keeping it because I was too committed. Had I had to start from scratch, Swift wouldn’t have been my first choice, a feeling that has overwhelmed me over time.
Regardless, I made my VPN library work in Swift on Android, Windows, and Linux.
Not exactly a one-shot prompt
Fast-forward to 2026, software development has changed like it never has before, and everyone knows what I’m talking about. What was an insanely tedious endeavor last year, suddenly became feasible. The last few months I delegated things to frontier LLMs that made me reasonably confident about their coding capabilities. Ironically, I didn’t trust them a bit only one year ago.
Two months ago, while a friend was talking to me about Zig, I joked about how long it’d take to rewrite my library from Swift to Zig, given I had absolutely zero knowledge of Zig at that time. This happened before the hyped post about the infamous Bun rewrite. I decided to give it a shot, and over a few hours of avid prompting, I managed to produce a smoke test of Partout connecting to my WireGuard server. If that wasn’t enough proof, the ridiculous drop in the library size (20MB -> 300kB) convinced me to dive into it. The footprint was definitely my biggest struggle with Swift.
Remarkably, but not proudly, I couldn’t write a single “Hello world” in Zig yet.
However, I’ve never bought into the story of “I single-prompted a video game”, so I was fully prepared to this outcome: the Zig MVP “worked”, but code-wise, it was a messy pile of crap. I could tell even without knowing the programming language.
It took me almost a month to shape the new library into a production-ready artifact, with my intended design and taste, and while I’m not 5% proficient in Zig like I’m in Swift, I learned a lot about the language through this challenging process. It also reminded me of low-level patterns that after years of Swift programming I took for granted. Just think of the complexity behind coroutines, e.g. Swift Concurrency, and how such model is hard to translate to systems programming.
Retaining ownership
Last year, I wrote a post about the risk of losing care for AI-coded products. I stand by that post today more than ever. Rewriting Partout to a programming language I didn’t know posed a concrete risk not only of losing care for its quality, but something way more fundamental: ownership.
What I call ownership of a software product is not knowing each line of code, as we programmers all know that feeling of not understanding even our own code after a while. Ownership is the ability to treat the software as a whole, whose code remains an important part, no matter what people say.
If we accept that code may age bad, we also accept that what sticks through the years is the design of the software. That’s why I poured my original design into the rewrite, even if coding was mostly driven by AI. From a design perspective, I made sure that Partout was as close as possible to the old Swift architecture, as this allowed me to retain the ownership of the project.
My advice
Delegating too much to AI is risky, especially if you’re learning to program. After 20 years in the field, I feel much more confident when it comes to making choices, and I’m happy with the new tools at disposal. However, AI or not, I would summarize the questions that you should never overlook about your software:
- Why it exists
- Who it serves
- What it does
- How it does it, to some extent (crucial for highly technical products)
- Where it’s going to
- Whether I could draft a change offline (somewhat implied)
If you can answer all of them, you are making good use of AI without outsourcing ownership and understanding.
Never stop asking yourself the same questions, at different times, through different struggles. This is the compass you’ll need through these strange times.