This repo allows you to run your SwiftUI projects completely on the web.
import SwiftWebUI SwiftWebUI.serve(Text("Hello, world!"))
The code is compiled to WebAssembly, and run entirely in the browser.
This is not a static site generator. By compiling Swift code to WASM, we can create stateful webapps entirely in Swift:
SwiftWebUI runs a Swift NIO server which handles the changes. With that approach, every time an action is made on the client, the server has to run the operations and send down the changes to the DOM.
This repo removes the need for a server by compiling the code to run in the browser itself. This allows for more flexible and efficient apps.
To create a new SwiftWebUI and WASM project, you can run:
npx carson-katri/swiftwebui-scripts create MyApp
For more information on
swiftwebui-scripts, view the repo.
A simple Router for SwiftWebUI
You can build the project with the following command:
swift build --triple wasm32-unknown-wasi