Swiftpack.co - productinfo/SwiftWasmWebUI as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by productinfo.
productinfo/SwiftWasmWebUI 0.2.2
https://github.com/carson-katri/SwiftWebUI
⭐️ 0
🕓 3 years ago
iOS macOS
.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: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

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