ElementaryUI runs declarative Swift apps in the browser via WebAssembly

The landing page at elementary.codes introduces ElementaryUI under the tagline "Swift in the Browser". The project's pitch is a single line: run declarative Swift applications natively in the browser with WebAssembly. The page describes it as an open-source project.

The page makes its case with one code sample, a small view called LoveCounter. It is declared as a struct marked with a @View attribute, and it keeps its mutable state in a @State variable named count, which starts at 1. The body of the view builds the page from HTML-like elements written as Swift: a p element holds a row of heart emoji, repeated as many times as the current count, and a button element sits below it.

The behaviour is simple. While count is below 10, the view shows a "More Love" button, and an .onClick modifier on it adds 1 to count, so each click adds another heart. Once count reaches 10, the view swaps that button for a p element reading "Enough love for you!" and a "Less Love" button, whose .onClick handler sets count back to 1 and starts the cycle again.

The sample shows the model the project is built around: a view as a Swift struct, state declared with a property attribute, conditionals written as ordinary Swift if and else, and event handlers attached as modifiers. The page closes with a thank-you to everyone supporting the project financially and an invitation to join them by sponsoring ElementaryUI. That is the whole text of the page.

Key facts

  • ElementaryUI is an open-source project for running declarative Swift applications natively in the browser with WebAssembly; its tagline is "Swift in the Browser".
  • The landing page's only example is LoveCounter, a struct marked @View with a @State count that starts at 1.
  • In the example, the "More Love" button adds 1 to count while it is below 10; at 10 the view shows "Enough love for you!" and a "Less Love" button that resets count to 1.
  • Views are written with HTML-like elements (p, button) and an .onClick modifier for handlers.
  • The project is supported financially by sponsors, and the page asks visitors to join them.

Why it matters

Swift is normally associated with native apps, and this project aims to bring the same declarative style to web pages by compiling to WebAssembly. The page's own framing is that Swift applications run natively in the browser. Its example reads like a SwiftUI-style view, with a @View struct, @State and a body, but built from web elements such as p and button.

Who it affects

The page is aimed at developers who write Swift and want to build browser interfaces in it. It does not name the people or organisation behind the project, and it does not say who the intended users are beyond that.

How to use it

The page gives a code sample and nothing else. Mark a struct with @View, keep mutable values in @State properties, describe the interface inside a body using elements like p and button, and attach handlers with .onClick. No installation or build instructions, and no tooling requirements, appear on the page. The project is open-source, and sponsorship is invited.

How solid is it

The only evidence is the project's own landing page, which holds a short claim and one small example. It gives no release version or date, no performance figures, no binary sizes and no browser-support details. The licence is not named beyond the label open-source. Nothing on the page compares it with SwiftUI or other Swift-to-WebAssembly tools.

Risks and caveats

Judging the project from this page alone is hard: there are no benchmarks, no stated maturity and no list of supported browsers. The example is a toy counter, so it says little about how the approach handles larger applications. The project relies on sponsor funding, and the page names no sponsors or amounts.

“Run declarative Swift applications natively in the browser with WebAssembly”

— ElementaryUI landing page