SwiftWasm Blog

Published on

What's new in SwiftWasm #4

SwiftWasm 5.3.0 and 5.3.1 releases

As you may have seen in our previous post, we've published our first stable release recently. Shortly after that, @flavio reported an issue with JSONDecoder. Following an investigation by @kateinoigakukun into the root cause of the issue, we've published SwiftWasm 5.3.1, which also included updates from the upstream 5.3.1 patch release.

(If you're interested in technical details, the JSONDecoder issue was caused by a peculiar assumption about memory layout in Swift runtime, which wasn't applicable to WebAssembly's linear memory. Check the PR diff for more details.)



A major update since the latest 0.8.0 release of JavaScriptKit is newly added support for throwing functions developed by @kateinoigakukun. It required an update to the JavaScript runtime part, but was an additive change to the Swift API. As we try to publish releases regularly, new 0.9.0 release was tagged that includes this feature.

A PR with support for Asyncify transformation was created by @yonihemi. It allows calling asynchronous JavaScript APIs with Swift code that looks as plain synchronous code, but through proper suspension that doesn't block browser rendering. The PR has some implications on how we build things, especially as it requires a specific optimizer transformation. It is still in the draft stage, and you're welcome to contribute to the ongoing discussion.


We still use a fork of OpenCombine in Tokamak due to our custom implementation of the ObservableObject protocol. In addition to that, our fork also contained some changes to the package manifest to make it build with SwiftWasm, but they made it incompatible with non-Wasm platforms. This issue was resolved in the upstream OpenCombine repository, which reduced the amount of customizations we apply, and brings us closer to using the upstream repository as is.


With progress on OpenCombine, it was time to publish the first version of OpenCombineJS. Its code didn't change recently, but parts of it were used in Tokamak already, which gave us confidence that it was reliable enough to be released in a separate library for wider use. It currently doesn't contain much code, but this basic functionality should be enough for basic integration of JavaScriptKit types and OpenCombine.


Following the 0.5.0 release, which added support for the latest carton, we published a small 0.5.1 patch with support for editing Tokamak projects in Xcode with working autocomplete. Not long after that an important bugfix landed in 0.5.2, which fixed an issue with display order of updated views in the DOM renderer. A few weeks later another bugfix release was published as 0.5.3. In this update Tokamak now internally relies on the aforementioned OpenCombineJS library instead of providing its own JSScheduler type conforming to Combine's Scheduler. More importantly, it fixes a bug with Toggle not being updated after resetting it from a binding.

Developer tools


@kateinoigakukun implemented a stripCustomSections transformation in the WasmTransformer library. According to the spec, data in custom sections should not contribute to observed behavior of a given binary. In the case of binaries produced by SwiftWasm, custom sections contain debugging information that can now be stripped with



Previously, custom sections were stripped to reduce final binary size as a build step in `carton bundle with the wasm-strip` utility from WABT. Thanks to the new transformation in WasmTransformer, WABT is no longer needed as a dependency of carton, which makes installation for our end users simpler and faster.

Initial support for presenting crash stack traces directly in carton has been completed, starting with Firefox support. Support for more browsers will be added in separate PRs.

There was also work on file downloader cleanup, support for browser testing, and simpler URLs for main bundle resources. As soon as these are merged, a new version of carton will be tagged that will use the latest 5.3.1 release of SwiftWasm.


A lot of the progress wouldn't be possible without payments from our GitHub Sponsors. Their contribution is deeply appreciated and allows us to spend more time on SwiftWasm projects. You can see the list of sponsors and make your contribution on the sponsorship pages of Carson Katri, Yuta Saito and Max Desiatov.

Thanks for reading! 👋