Swift for Wasm November 2026 Updates

Notable changes this month: JavaScriptKit 0.64.0 optimizations make creating, passing and releasing JSObjects 30-50% faster; WasmKit 0.5.0 added wasm2wat and the wide-arithmetic proposal; ElementaryUI 0.9.0 added ForEach keyed by id and server-side rendering; uWASI gained an OPFS filesystem backend for browser storage.

Many thanks to @felipepiovezan, k0michi, @kabiroberai, @kateinoigakukun, @kebo, @krodak, @Logan_Shire, @mozharovsky, @silver-ben, @sliemeobn, @Tony_Parker, and Vithanco for contributions!

Forum Discussions

Swift Toolchain

swiftc on development snapshots gained experimental support for loading a macro compiled to a statically linked Wasm binary, meaning consumers of the macro would not need to depend on SwiftSyntax. LLDB gained Wasm global, symbol and frame-ordering fixes.

  • Add experimental support for Wasm macros, loaded with -load-plugin-executable Foo.wasm#Foo swift#73031;
  • Run the wasip1-threads tests under WasmKit, build the Embedded standard library for the wasip1-threads triple, and initialize a global Mutex statically on WASI swift#92238;
  • Document the Wasm ABI for Swift async functions, async context is always in local 0 swift#93554, and preserve the async-context attribute on swift_task_switch and swift_asyncLet_finish, where declarations lowered to inconsistent signatures with Wasm tail calls swift#93062;
  • LLDB: scope Wasm global reads to a module instance llvm-project#14800, create data symbols from the Wasm export section llvm-project#14845, read Wasm globals through a frame of the stub's own thread llvm-project#14866, number the Wasm virtual registers llvm-project#14871, and order frames by their call frame addresses, Wasm frames included llvm-project#15106;
  • Fix an LLVM assertion on a function with a stack protector that ends in a Wasm tail call llvm-project#15074.

JavaScriptKit

JavaScriptKit 0.63.0 fixed BridgeJS glue for thrown errors and JSValue ownership and shrank --wasi-runtime uwasi bundles, 0.63.1 fixed two typed array copy bugs, and 0.64.0 stopped deduplicating JSObject references in the object heap. Creating, passing and releasing JSObjects is now 30-50% faster, and the cost no longer grows with the number of live objects. As a trade-off, JSObject is no longer Hashable, and JSObject.== calls into JavaScript to compare with ===.

  • BridgeJS: check thrown errors before lifting return values, so an exported throws(JSException) function that returns a JSObject throws the Swift error in JavaScript instead of a ReferenceError #824;
  • BridgeJS: diagnose async and throwing @JS struct initializers #825;
  • BridgeJS: fix JSValue reference ownership across the bridge, which crashed when returning a JSValue that Swift created #826;
  • PackageToJS: import only the UWASI features Swift needs, which shrinks a --wasi-runtime uwasi bundle from 8.8 KB to 4.8 KB, minified and gzipped #827;
  • Runtime: copy only the view's window in swjs_load_typed_array, instead of the whole backing ArrayBuffer #810;
  • BridgeJS: normalize the pointer in swift_js_push_typed_array, which read the wrong range once memory grew past 2 GiB #828;
  • Runtime: stop deduplicating JSObject references in the object heap #835.

WasmKit

0.5.0 adds the wasm2wat function and CLI for disassembling .wasm modules, support for the wide-arithmetic proposal, guard-page memory on iOS and Android, WASI calls that trap on out-of-bounds guest pointers, and faster execution through new instruction fusions.

  • Add the wasm2wat function and CLI #305;
  • Read the opcode after a prefix byte as LEB128, so overlong encodings such as fc 80 00 decode #510, and support the wide-arithmetic proposal #511;
  • Return after a tail call to a host function, instead of running the code that follows it #509;
  • WASI: trap on an out-of-bounds guest pointer, which used to stop the host process #524, and transfer short when iovec lengths add up past 4 GiB #525;
  • Enable guard-page shared memory and WASI Threads on iOS #513, and guard-page memory bounds checking on Android #527;
  • Reclaim unused constant-pool reservations before spilling literals #516;
  • Keep small internal calls off the native stack #517;
  • Fuse instruction sequences common in compiled code #529, and xor-shift mixing sequences #518;
  • Fix the WITOverlayGenerator output for Swift 6 mode #533.

ElementaryUI

ElementaryUI 0.8.1 sped up attribute patching. 0.9.0 added ForEach keyed by any Hashable id:, basic server-side rendering of views with .render(), and faster list updates and reactive state changes; it deprecates key: and .key() in favor of id: and .id(), and ForEach now requires a RandomAccessCollection. 0.9.1 added @ViewEquatableIgnored, and 0.9.2 fixed the bezier timing curves and added SVG transforms.

  • Faster attribute patching #144;
  • Basic support for SSR/SSG rendering of views #145;
  • Persistent reactive listeners, so a function view without reactive reads no longer allocates a listener #146, with an allocation-free listener callback for schedulable nodes #148 and cheaper listener fan-in #147;
  • Key ForEach by any Hashable id, with per-row tracking #149, and make row tracking and updates cheaper #150;
  • Switch the examples, benchmarks and integration tests to uWASI, for a JavaScript bundle about 6.7 kB smaller #155;
  • Replace the _Reconcilable unmount with a per-slot unmount registry #156;
  • Store state and environment values in UniqueAny #157, and use assert instead of precondition on hot typed-access checks #161;
  • Make the CustomAnimation defaults public #158;
  • Implement @ViewEquatableIgnored #163;
  • Unify modifier and environment dependency tracking #162;
  • Fix bezier timing curves to match CSS cubic-bezier() #164;
  • Skip style updates queued for a modifier that has since unmounted, which tripped a precondition when a fade was removed without animation in the same tick as an animated sibling #167;
  • Add rotationEffect and scaleEffect for SVG #126.

uWASI

On main, an OPFS filesystem backend lets a browser guest keep its files across page reloads and worker restarts.

  • Add an OPFS filesystem backend #35.

Other Projects

  • Foundation: fix the wasm32-unknown-emscripten build of FoundationEssentials by importing EmscriptenLibc swift-foundation#2359, stop createDirectory(atPath:withIntermediateDirectories:) recursing past /, which never ended on WASI without a preopen covering / swift-foundation#2409, and build more of FoundationEssentials and FoundationInternationalization for Embedded Swift on Wasm swift-foundation#2368, including XML property list parsing swift-foundation#2456;
  • Add WASI support to swift-format, which now builds with its tests for wasm32-unknown-wasip1 and wasm32-unknown-wasip1-threads swift-format#1319;
  • Pass --wasi-threads to WasmKit for wasip1-threads in the Swift SDK generator swift-sdk-generator#284;
  • vite-plugin-swift-wasm: preload the wasm module in HTML entries vite-plugin-swift-wasm#9, and add js options with wasiRuntime vite-plugin-swift-wasm#10.

Thank you for reading, and please feel free to add any comments or suggestions if we missed anything!

If you'd like to catch up with changes from previous months, here's a list of recent updates:

16 Likes