qmetrics.net

SwiftWebUI

SwiftUI API implementation for web browsers

SwiftWebUI screenshot

SwiftWebUI renders SwiftUI views in a browser and keeps a live link to Swift code on the server. The authors describe it as a learning-oriented demo, not for production.

Overview

SwiftWebUI implements much of the SwiftUI API so developers can declare Views that appear in a web browser. Unlike approaches that only translate views to static HTML, it opens a channel between the browser and Swift code running on a server so controls such as buttons, pickers, steppers, lists, and navigation can update interactively.

A small HTTP server using SwiftNIO on port 1337 serves pages. When a browser connects, the framework creates a session, builds a server-side representation of the view tree, renders HTML, and keeps state to diff later updates. User actions in the browser call back into Swift handlers, which can mutate state and push DOM changes as JSON or HTML fragments.

SwiftWebUI is a toy for exploring SwiftUI internals rather than shipping production sites. Apple’s SwiftUI goal of learn once, use anywhere does not mean iOS SwiftUI code will necessarily look identical in the browser.

Running it requires Swift 5.2 or later. macOS 10.15 or newer is one supported host; Linux is supported with OpenCombine for some APIs. A Docker image with a Swift 5.1 snapshot is available for Linux setups. Integration is via Swift Package Manager in an Xcode command-line tool project.

Key features

  • SwiftUI Views in the browser
  • Interactive server-linked UI
  • SwiftNIO HTTP serving
  • State and tapAction handlers
  • Session-based multi-user serving
  • Linux support via OpenCombine
  • Docker image for Swift toolchain
  • SwiftPM dependency integration

Use cases

  • Learning how SwiftUI works
  • Prototyping SwiftUI in the browser
  • Exploring cross-platform UI patterns
  • Demo apps such as Avocado Toast samples

Tags

Similar software

Flutter

Open-source UI framework for multi-platform apps from one codebase

Flutter is an SDK for building user experiences for mobile, web, and desktop from a single codebase. It uses the Dart language and compiles to native machine code or web targets.

  • Single codebase for multiple platforms
  • Dart with native and web compilation
  • Stateful hot reload during development
DartWeb, Linux, macOS, WindowsDetails →
★ 181.6k⟳ todayBSD-3-Clause
Open Source Alternative to:Adobe AIRIonic Enterprise

Bootstrap

Responsive HTML, CSS, and JavaScript front-end toolkit

Bootstrap supplies CSS, JavaScript, and Sass-based styles for building responsive, mobile-first sites. It ships prebuilt grid layouts, UI components, and optional JavaScript plugins.

  • Responsive mobile-first CSS layout
  • Prebuilt UI components
  • Sass-based customization
JavaScriptDetails →
★ 175.1k⟳ 3 days agoMIT

Next.js

React framework for full-stack web applications

Next.js lets you build full-stack web apps by extending React and integrating Rust-based JavaScript build tooling.

  • Full-stack web development on React
  • Rust-based JavaScript build tooling
  • Server and static rendering focus
JavaScriptWebDetails →
★ 144k⟳ todayMIT

React Native

Cross-platform native mobile framework using React

React Native lets developers build Android and iOS interfaces with React components rendered through native platform APIs. JavaScript changes can refresh quickly during development.

  • React component model on mobile
  • Native platform UI rendering
  • Android and iOS targets
C++Android, iOSDetails →
★ 127k⟳ todayMIT
Open Source Alternative to:Ionic Enterprise

Electron

Cross-platform desktop application framework for web technologies

Electron lets developers build desktop applications with JavaScript, HTML, and CSS. It combines Node.js and Chromium so web code can run as native apps on major operating systems.

  • JavaScript, HTML, and CSS desktop apps
  • Embedded Chromium and Node.js runtime
  • macOS, Windows, and Linux binaries
C++Linux, macOS, WindowsDetails →
★ 124.3k⟳ todayMIT
Open Source Alternative to:Adobe AIR

Node.js

Cross-platform open-source JavaScript runtime environment

Node.js is an open-source, cross-platform JavaScript runtime. It lets developers create servers, web apps, command line tools, and scripts.

  • Cross-platform JavaScript execution
  • HTTP server and networking APIs
  • Streams and file I/O modules
JavaScriptCLIDetails →
★ 123.9k⟳ todayMIT