Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

OP here. UI state lives in the GUI code. For a GUI toolkit like SwiftUI, that's quite important ergonomically.

I'm unsure how to really describe how the "bridge" code looks. All GUI interaction code happens in Swift, and when buttons are pressed and so on, I call functions back into Zig, and so on.

There are certain scenarios where my Zig code calls back into Swift (via function pointers provided). For example, requesting to quit the application. These are handled using NSNotificationCenter accordingly.

As I stated in the post, my cross-platform layer is >90% of my lines of code, and this isn't a trivial program, so for my use case this is working great.



The post is great, hope I didn't seem to be critiquing it! I liked the idea so much I wondered if theres a magic reactive layer with data bindings so I could use it in UI heavy cross platform apps.


Interesting.

I am thinking of writing such bridge for ly use case using Wasm (Wazero) with Go.

Hoping the perf impact of crossing the bridge will not be too high.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: