Swiftpack.co -  Package - productinfo/SwiftWasmWebUI
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
productinfo/SwiftWasmWebUI
https://github.com/carson-katri/SwiftWebUI
.package(url: "https://github.com/productinfo/SwiftWasmWebUI.git", from: "0.2.2")

SwiftWebUI and WASM

This is a fork of the incredible SwiftWebUI to support WebAssembly via swiftwasm.

What does it do?

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:

Demo GIF

How is it different from the main SwiftWebUI?

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.

Get Started

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.

Helpful Packages

Examples

Contributing

You can build the project with the following command:

swift build --triple wasm32-unknown-wasi

GitHub

link
Stars: 0
Last commit: 6 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco