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…
Moving on While I don’t usually leave my projects incomplete, especially with the finish line in sight (“Architecture” was supposed to be the very last topic), I’m going to end this series a little earlier than planned. Many things have changed in software over the last year, and what looked like a legit effort a year ago has become increasingly harder to justify today. As much as I love Swift as…
It’s been a while since the announcement of the last post, but I finally found the time to kickstart the last part of this series. Today, we start gathering all the previous research to make Swift and non-Swift apps that share a common Swift library. You will find the source code on GitHub as usual. The simple app layout The idea is straightforward: we want to make apps with a native UI and a…
In the previous post, I threw in a few ideas about how to integrate Swift logic with non-Swift code. We learned how to call Swift code from other languages with @_cdecl, but now we need to fill a few remaining gaps to build a modern non-Swift application on top of our Swift library. You can find the source code of these examples on GitHub. Asynchronous calls There’s no such thing as concurrency…
We are at a stage where Partout, our cross-platform Swift library: Builds as a static library Emits a Swift module interface for use in other Swift code Comes with a few vendored dependencies as dynamic libraries (OpenSSL, WireGuard) Uses C for low-level routines, including OS frameworks or the NDK on Android Doesn’t use Apple frameworks, unless behind availability conditionals Doesn’t use…
Since the last article, I’ve made significant progress about improving the build system of Passepartout/Partout and the layout of the outputs. That’s why I felt compelled to explore this part of the series a bit further before climbing up the software layers. Here I go through a few tricks that made the process both simpler and more efficient. Trick 1: CMake toolchains As mentioned before, SwiftPM…
Our goals Before heading back to the Partout code, let’s focus on our ultimate goals: Build as Swift module on Apple platforms Build as dynamic library on other platforms (.so on Linux/Android, .dll on Windows) Adding that: Step 1 is natural with SwiftPM, except for how to manage dependencies Step 2 involves OpenSSL (C), WireGuard (Go), and Wintun (Windows DLL) at the time of writing, plus the…
There is a reason why it took me two months since the last post, and ironically it’s the very subject of this writing. I hate to say, but the build tools are the most painful and work-in-progress aspect of Swift, at least at the time of writing. Brace yourself. SwiftPM is just not ready This post risks having a negative vibe, so I want to discuss solutions before problems. The first advice I can…
While I have nothing against “vibe coding” per se, I think it harms software-making in the way too many casual relationships do to the ability to make long-term bonds. In fact, it’s not about coding at all. It’s about building “care” for the product. If I replace MVP with ONS in the equation, I notice eerie similarities. You build MVPs faster with AI, as you may get sex faster with a dating app,…
While writing C in a Swift context makes no difference at all, it takes a few tricks to reduce the friction in Swift code that embeds C routines. You will find tangible examples of what I describe here on my GitHub repository. Let’s go through them together. The mystique of Swift pointers Swift has often changed the way it interacts with C entities, especially around version 3 and 4, IIRC. It has…