One approach to building a native GUI for a cross-platform application is to write all of the business logic in a cross-platform language (C, Rust, Zig, etc.) and then write the platform-specific GUI code. This is the approach I take with my my terminal emulator and it works really well. As of the current date writing this post, 93% of my repository is business logic in Zig and C, and 4% is macOS-specific GUI code in Swift.

As a result, my terminal emulator is truly native: you get native Mac windows, Mac GUI components (buttons, text fields), etc. It looks and feels great. But its also still cross-platform: I support Linux (using GTK) while sharing ~90% of all code. In this post, I'll share details about how this setup works and why I approached GUI programming this way.