hn.today

ElementaryUI – Swift, in the Browser

elementary.codes80 points16 comments
Screenshot of ElementaryUI – Swift, in the Browser

ElementaryUI is an open-source framework for building browser interfaces in Swift and running them as WebAssembly applications. Its declarative, SwiftUI-inspired APIs let developers describe UI elements and interactions using familiar Swift syntax. Built-in reactivity updates the interface as values change, with features including @State, @Environment, and @Reactive. The project emphasizes small downloads: support for Embedded Swift is intended to produce WebAssembly bundles measured in kilobytes rather than megabytes.

A sample “Love Counter” shows the approach: a state variable tracks a number of hearts, a button increments it, and conditional logic switches the interface once the count reaches ten, offering a reset button. ElementaryUI also provides CSS-based animations, including automatic FLIP transitions, and uses Vite for a development server with hot reload. The site offers a getting-started guide and API reference, and invites users to participate through GitHub, social channels, and Discord or support the project through sponsorship. It is an independent project, not affiliated with or endorsed by Apple.

Read on elementary.codes16 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.