Swift vs Rust for WASM/WebAssembly

I don’t have a lot of experience with Swift, so I can’t really comment on it. Rust works very well with web assembly (some assembly required, heh). One of the reasons I picked up Rust was that it made it easy to write tutorials and include a web-runnable version (my Roguelike Tutorial series has each example as a playable web game - e.g. https://bfnightly.bracketproductions.com/rustbook/wasm/chapter-74-darkcity/ ).

There are downsides. If you link with C libraries, chances are you have to come up with some shims to handle the bits of the C library that don’t exist in WASM-land. Also WebGL is almost but not quite compatible with regular GL - so for graphics you’ll have to tweak things a bit.

2 Likes