First stable release of SwiftWasm 5.3 is now available

You may have seen some posts about WebAssembly support in Swift on these forums previously. These were mostly questions and discussions about the toolchain development. Today I'm excited to make an announcement first and foremost for end users of Swift interested in applying it on more platforms.

As a culmination of hard work from many people, the first stable release of SwiftWasm 5.3 is available. It allows you to compile your Swift code to WebAssembly, and to interact with the host WebAssembly environment through libraries that the SwiftWasm team maintains. WebAssembly is supported in all recently released major browsers, which means you can build browser apps written purely in Swift (although some JavaScript glue code invisible to users is required under the hood). Non-browser Wasm hosts are also supported, such as Node.js, Wasmer, or any other WASI-compatible hosts.

It is available as a signed .pkg installer for macOS (only Intel for now, but Apple Silicon builds are coming soon), and via swiftenv-compatible archives for Intel-based Ubuntu 18.04 and 20.04. We also provide Docker images for these Ubuntu releases.

While these installation methods may be useful for advanced use cases, carton is our recommended development tool that simplifies toolchain installation, building, testing, and packaging of SwiftWasm apps running in the browser. It is available via Homebrew and also for same Linux distributions as SwiftWasm itself. We also have a GitHub Action to make it easy to publish SwiftWasm apps with carton. Please follow our guide in the SwiftWasm book to get started with carton.

Important to note, that while SwiftWasm may be appropriate for general use, it is not directly affiliated with the upstream Swift project. Our 5.3.0 release is based on the upstream 5.3.0 release of Swift, but applies patches necessary to enable WebAssembly support on top of that in our fork. With our limited resources we're working on making these changes available upstream, in parallel with the development of other SwiftWasm libraries and tools. Try SwiftWasm in your projects, and let us know of your experience. All feedback and contributions are very welcome and help the ecosystem to move forward!

Lastly, I need to mention that I deeply appreciate the work of the SwiftWasm team (Zhouwei Zhang, @kateinoigakukun, @carsonkatri, @j-f1, @RayZhao), upstream Swift contributors (@millenomi, @compnerd, @Michael_Gottesman, @ddunbar, Anders Bertelrud, @Aciid, @NeoNacho, Mattt), our GitHub sponsors, early adopters, and many others I probably forgot to mention. Without your help this project wouldn't be possible!

85 Likes

This is really exciting! We'd love to work with you to get a sense of what changes you've needed and to get your changes upstreamed into main.

Would you like a category in Related Projects? I don't know where you're currently collaborating.

14 Likes

Our biggest upstreaming blocker is the module summary PR. Our focus in the toolchain work right now is on size reductions of produced binaries. Getting this PR reviewed and merged is a big part of usptreaming that work. I've already pinged a couple of people about it, and I know you folks are busy, but if this PR could be added to someone's queue at some point, that would be great!

Thanks for the offer! We don't have anything for broad public discussions at the moment. I know some people prefer the Forums to stay dedicated to the language itself (whatever that means). I don't know if you would like to limit this hypothetical new category to topics strictly about SwiftWasm, or if discussions about related libraries supporting SwiftWasm would fit that category too? I feel that some folks who expressed interest hesitated to create a GitHub issue in our repositories, could we redirect them with general questions to this new category then?

2 Likes

The forums are meant to support the whole community. Web Assembly support isn't primarily an evolution topic, but there's plenty of room on the forums for non-evolution topics. What you're doing right now seems to be about 80% compiler and toolchain work (definitely on-topic in Development), and as time goes on there'll be an increasing share of library work (definitely on-topic in Related Projects, potentially on-topic in Development, possibly even on-topic in Evolution if you have something community-wide to propose). So yeah, it's all welcome here.

3 Likes

This makes sense. A category in "Related Projects" should definitely work then!

1 Like

Alright. Feel free to ask for one and CC me; there's a regular process for this.

1 Like

Amazing work!

2 Likes

Awesome work by everyone involved and congratulations on the release! I am very excited about the prospects of using Swift for shipping production-ready Web apps and I will certainly try to find an opportunity to try out this toolchain.

1 Like