deniz.in

Markets

Weather

Loading weather

· via Hacker News – Front Page (native)

ElementaryUI brings SwiftUI-style declarative Swift to the browser via WebAssembly

ElementaryUI compiles SwiftUI-style declarative Swift to WebAssembly so apps can run natively in the browser, with built-in state management and wasm bundles measured in kilobytes.

ElementaryUI brings SwiftUI-style declarative Swift to the browser via WebAssembly

A Swift take on browser UIs

ElementaryUI, an open-source project that reached Hacker News's front page on 29 October 2026, lets developers build user interfaces in Swift and run them directly in the browser by compiling to WebAssembly. According to the project's site, the framework models its APIs on SwiftUI, so people who already know Apple's declarative toolkit should find the syntax recognisable while targeting ordinary web elements.

The pitch, as the site lays it out, rests on three legs: SwiftUI-like syntax for describing UIs, state management handled by the framework itself, and wasm bundles that stay in the kilobyte range rather than ballooning to megabytes.

What the code looks like

The example on the project's landing page is a LoveCounter view. It is a Swift struct holding one piece of state, count, declared with the @State property wrapper and starting at 1. The view's body renders a paragraph containing a repeated heart emoji, then branches: while the count is under ten, a button increments it on every click; once the cap is hit, the view swaps the button for a message and a control that resets the counter.

The interesting part is not the counter itself but the lack of ceremony around it. There is no manual DOM manipulation, no explicit refresh call, and no JavaScript glue visible in the listing. The UI is described declaratively, and the framework is responsible for applying changes when state moves.

Reactivity, animation and tooling

According to the project's page, reactivity is built around three property wrappers — @State, @Environment and @Reactive — with updates applied automatically instead of through hand-written update logic. On top of that sits an animation system built on CSS, including automatic FLIP transitions, the technique where elements that shift between layout states are animated from their old position to the new one.

For everyday development, ElementaryUI plugs into Vite, giving developers a dev server with hot reload so changes show up quickly during iteration. The small bundle sizes come from compiling with full Embedded Swift support — the compact dialect of Swift intended for targets where a full runtime would be too heavy — which the project credits with keeping wasm output down to kilobytes.

The project is open source and supported financially by sponsors, and its site invites users to join them.

What the landing page leaves open

As with any project page, this is a pitch rather than documentation. The site does not state which browsers are targeted, how (or whether) the framework interoperates with the wider JavaScript ecosystem and npm packages, how far along development is, or what a stable release timeline looks like. Those questions will matter for anyone deciding whether to build on it.

Why it matters

WebAssembly has long promised to open front-end development beyond JavaScript, but UI frameworks that compile to wasm have frequently stumbled on payload size: downloads measured in megabytes are a hard sell for consumer-facing web apps. By leaning on Embedded Swift to keep bundles in the kilobyte range, ElementaryUI aims squarely at that weakness. For the large pool of developers who already know SwiftUI, it offers a way to carry that skill set onto the web. For everyone else, it is another data point in a broader trend of mature native-language toolchains — Rust, C#, Kotlin and now Swift — treating the browser as just another compilation target. Whether it grows beyond an intriguing demo depends on exactly the questions the landing page does not answer: ecosystem interop, browser coverage and long-term maintenance.

  • #swift
  • #webassembly
  • #swiftui
  • #front-end
  • #open-source

Related posts