Hello there, lovely Swift community!
A web framework? In Swift? With WebAssembly?
Listen, I know, creating a new web framework can feel like a bit of a fool's errand.
But what are you gonna do? Use JavaScript for the rest of your life? Write apps in Rust? Wait for the web to go away?
So, instead of listing all the reasons in our heads why this may fail, let's work together and say:
Yes: ElementaryUI !
Swift in the Browser - Run declarative Swift applications natively in the browser with WebAssembly
SwiftUI-inspired APIs - Familiar and intuitive syntax for building web UIs
Built-in Reactivity - Automatic state management with @State,@Environment, and@Reactive
Tiny Binaries - Full Embedded Swift support means kB-sized wasm bundles instead of MB
Magical Animations - Powerful CSS-based animation system including automatic FLIP transitions
Vite-Powered Development - Fast dev server with hot reload for rapid iteration
What is it?
ElementaryUI is a Swift frontend framework that runs in the browser. It lets you build web applications in Swift instead of JavaScript, bringing Swift's safety and expressiveness to frontend development.
It takes inspiration from SwiftUI to provide an idiomatic way to describe state-driven user interfaces while firmly staying a web framework.
import ElementaryUI
@View
struct Counter {
@State var count = 0
var body: some HTML {
div {
p { "Count: \(count)" }
button { "Increment" }
.onClick { count += 1 }
}
}
}
Early Days, Big Mission
I'll be honest, this is an ambitious open-source project in its very early days. The foundation is starting to settle, but there is still a lot to build, invent, and improve.
However, the mission is clear: Make Swift a first-class option for web projects, and keep the project healthy for the long run.
If you are building a production-critical banking dashboard today, maybe wait a bit. But if you are a Swift enthusiast looking to build a personal project, an internal tool, or a web component without touching JavaScript, now is the perfect time to dive in.
Get Involved
There's plenty of work ahead to make Swift a truly first-class web technology:
- Web components support
- Client-side routing
- Server-side rendering
- And much more...
Whether you want to contribute code, try it out, give feedback, or sponsor development, we'd love to have you!
- Docs & Get Started: https://elementary.codes
- GitHub: GitHub - elementary-swift/elementary-ui: Build SwiftUI-style apps that run in the browser
- Discord: #elementary-ui on SwiftWasm
Let's make Swift in the browser a reality together! ![]()
