Swift for Wasm February 2026 Updates

Hello Swift community! Here's a summary of notable changes and improvements to Swift for WebAssembly projects during February 2026. This includes, but is not limited to BridgeJS reaching MVP in JavaScriptKit, preliminary Component Model work in WasmKit, and new features in ElementaryUI. These contributions and updates were provided by @kateinoigakukun, @sliemeobn, @krodak, @maplekiwi, @kebo, and Minjae Gwon.

Swift Toolchain

JavaScriptKit: BridgeJS MVP Release! :bridge_at_night:

February saw intensive development of BridgeJS, the bidirectional JavaScript/Swift interop layer. Highlights:

Version 0.44.1 release marks the MVP of BridgeJS, a new interop mechanism that makes Swift-JavaScript interop faster, easier, and type-safe for WebAssembly apps.
With BridgeJS, you declare the shape of your API using Swift macros (or optionally TypeScript definitions), and the tool generates specialized bridging code in both directions, exporting Swift to JavaScript and importing JavaScript into Swift.

Compared to the dynamic JSObject/JSValue APIs, BridgeJS offers significantly better performance through specialized codegen, compile-time type safety, and less boilerplate.

See the BridgeJS documentation to get started.

Note:
You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the BridgeJS Playground.

Exporting Swift to JavaScript

Mark Swift code with @JS to make it callable from JavaScript:

import JavaScriptKit

@JS class Greeter {
    @JS var name: String

    @JS init(name: String) {
        self.name = name
    }

    @JS func greet() -> String {
        return "Hello, \(name)!"
    }
}

JavaScript usage:

const greeter = new exports.Greeter("World");
console.log(greeter.greet()); // "Hello, World!"

Learn more: Exporting Swift to JavaScript

Importing JavaScript into Swift

Declare bindings in Swift with macros such as @JSFunction, @JSClass, @JSGetter, and @JSSetter:

import JavaScriptKit

// JS class instance backed by a Swift struct
@JSClass struct Document {
    @JSFunction func getElementById(_ id: String) throws(JSException) -> HTMLElement
    @JSFunction func createElement(_ tagName: String) throws(JSException) -> HTMLElement
}
@JSGetter(from: .global) var document: Document

@JSClass struct HTMLElement {
    @JSGetter var innerText: String
    @JSSetter func setInnerText(_ newValue: String) throws(JSException)
    @JSFunction func appendChild(_ child: HTMLElement) throws(JSException)
}

@JS func run() throws(JSException) {
    let button = try document.createElement("button")
    try button.setInnerText("Click Me")
    let container = try document.getElementById("app")
    try container.appendChild(button)
}

You can also generate the same macro-annotated Swift from a TypeScript file (bridge-js.d.ts). See Generating bindings from TypeScript in the documentation.

Learn more: Importing JavaScript into Swift

WasmKit

In February we saw substantial amount of work on Component Model support in WasmKit and multiple bug fixes:

ElementaryUI

New features: @FocusState and .focused modifier (#63), Group view (#66, #67), and FilterModifier with blur, saturation, and brightness (#70) were added.

Performance: more efficient style and attribute handling (#65), improved string and JS-interop performance (#77), and size benchmarks with CI (#71, #72, #74).

Maintenance: JavaScriptKit upgraded 0.46 (#78), fixes for ForEach reactivity (#73) and _ViewKey hashing (#79).


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

25 Likes