You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At
WWDC 2019
Apple announced
SwiftUI.
A single "cross platform", "declarative" framework used to build
tvOS, macOS, watchOS and iOS
UIs.
SwiftWebUI
is bringing that to the Web ✔️
Disclaimer: This is a toy project!
Do not use for production.
Use it to learn more about SwiftUI and its inner workings.
SwiftWebUI
So what exactly is
SwiftWebUI?
It allows you to write SwiftUI
Views
which display in a web browser:
Unlike some other efforts this doesn't just render SwiftUI Views
as HTML.
It also sets up a connection between the browser and the code hosted
in the Swift server, allowing for interaction -
buttons, pickers, steppers, lists, navigation, you get it all!
In other words:
SwiftWebUI
is an implementation of (many but not all parts of) the SwiftUI API for the browser.
To repeat the
Disclaimer: This is a toy project!
Do not use for production.
Use it to learn more about SwiftUI and its inner workings.
Requirements
On a Mac macOS 10.15 or later is required.
tuxOS
SwiftWebUI now runs on Linux using
OpenCombine (also works without
that, but then some things don't work, e.g. NavigationView).
Swift 5.2 or later is required.
We also provide a Docker image containing a 5.1 snapshot over here:
helje5/swift.
SwiftWebUI Hello World
To setup a SwiftWebUI project,
create a "macOS tool project" in Xcode 11,
then use the new SwiftPM integration and add
https://github.com/SwiftWebUI/SwiftWebUI
as a dependency.
Open the main.swift file and replace it's content
with: