SwiftUI with support for WebAssembly

Overview

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
You might also like...
Orbit-swiftui - Orbit design system implemented in SwiftUI for iOS

Orbit is a SwiftUI component library which provides developers the easiest possi

SwiftUI Resume - A simple resume writed by swiftUI + Combine
SwiftUI Resume - A simple resume writed by swiftUI + Combine

SwiftUI_Resume a simple "resume" writed by swiftUI + Combine

SwiftUI-MSALSample - Sample project to login with MSAL using SwiftUI
SwiftUI-MSALSample - Sample project to login with MSAL using SwiftUI

SwiftUI-MSALSample I could not find a good walkthrough on how to implement MSAL

100-Days-of-SwiftUI - Studying through Paul Hudson's 100 Days of SwiftUI
100-Days-of-SwiftUI - Studying through Paul Hudson's 100 Days of SwiftUI

Hacking with SwiftUI 100 Days of SwiftUI Studying through Paul Hudson's "100 Day

Watchos-navlink-swiftui-bug - Example Project to demonstrate bug in SwiftUI when NavigationLink is activated inside a TabView SwiftUI-Card - Simple card ui designed using SwiftUI
SwiftUI-Card - Simple card ui designed using SwiftUI

SwiftUI - Card Simple card ui designed using SwiftUI Preview

Swiftui-pressed-states-example - Examples of Pressed States in SwiftUI

Examples of Pressed States in SwiftUI pressed-states.mp4

IOS15-SwiftUI-InAppPurchaseDemo - In-App Purchase Demo app written with SwiftUI
IOS15-SwiftUI-InAppPurchaseDemo - In-App Purchase Demo app written with SwiftUI

iOS15-SwiftUI-InAppPurchaseDemo In-App Purchase Demo app written with SwiftUI If

SwiftUI Backports - Introducing a collection of SwiftUI backports to make your iOS development easier

SwiftUI Backports Introducing a collection of SwiftUI backports to make your iOS development easier. Many backports support iOS 13+ but where UIKIt fe

Comments
  • invalid Darwin version number: macos11.1

    invalid Darwin version number: macos11.1

    my-app % make
    cd MyApp && \
    	swift build --triple wasm32-unknown-wasi && \
    	cp .build/debug/MyApp ../dist/SwiftWASM.wasm && \
    	wasm-strip ../dist/SwiftWASM.wasm && \
    	gzip ../dist/SwiftWASM.wasm --best
    /Users/az/swift/src/github.com/felicitaspublica/my-app/MyApp: error: manifest parse error(s):
    <unknown>:0: error: invalid Darwin version number: macos11.1
    <unknown>:0: error: invalid version number in '-target x86_64-apple-macos11.1'
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Combine.framework/Modules/Combine.swiftmodule/x86_64-apple-macos.swiftinterface:1:1: error: failed to build module 'Combine' from its module interface; the compiler that produced it, 'Apple Swift version 5.3.1 (swiftlang-1200.2.41 clang-1200.0.32.8)', may have used features that aren't supported by this compiler, 'Swift version 5.3-dev (LLVM b978bd2044, Swift 6b21aa1cfd)'
    // swift-interface-format-version: 1.0
    ^
    <unknown>:0: error: invalid Darwin version number: macos11.1
    <unknown>:0: error: invalid version number in '-target x86_64-apple-macos11.1'
    make: *** [build] Error 1
    
    opened by mycroftcanner 0
Owner
Carson Katri
| WWDC19 Scholarship Winner | Mobile + Web |
Carson Katri
macOS support for the Surface Dial

Mac Dial macOS support for the Surface Dial. The surface dial can be paired with macOS but any input results in invalid mouse inputs on macOS. This ap

Andreas Karlsson 104 Jan 5, 2023
An iOS app that lets user quickly jot down thoughts with Markdown support

Thoughtless An iOS app that lets user quickly jot down thoughts with Markdown support. Description Perhaps you are often in a situation where you want

Yohannes Wijaya 25 May 24, 2022
Firebase Cloud Firestore support library for iOS. 🧢

?? Ballcap-iOS Ballcap is a database schema design framework for Cloud Firestore. Why Ballcap Cloud Firestore is a great schema-less and flexible data

1amageek 229 Jan 2, 2023
🎲 100% SwiftUI 2.0, classic 2048 game [SwiftUI 2.0, iOS 14.0+, iPadOS 14.0+, macOS 11.0+, Swift 5.3].

swiftui-2048 If you like the project, please give it a star ⭐ It will show the creator your appreciation and help others to discover the repo. ✍️ Abou

Astemir Eleev 174 Dec 17, 2022
A simple SwiftUI Application to demonstrate creation of UI using SwiftUI.

WatchShop_UI A simple SwiftUI Application to demonstrate creation of UI using SwiftUI. How to run the project ? Fork the project. Run the project usin

Shubham Kr. Singh 12 Apr 15, 2022
E-commerce app built in SwiftUI. Built in the course SwiftUI Masterclass in Udemy.

Touchdown-SwiftUI E-commerce app built in SwiftUI. Built in the course SwiftUI Masterclass in Udemy. Main components and concepts used: @EnvironmentOb

Jorge Martinez 5 Aug 18, 2022
A multiplatform SwiftUI project demonstrating various SwiftUI features.

WikiDemo A multiplatform SwiftUI project demonstrating various SwiftUI features, including creating a master-detail interface. It's a multiplatform ve

Swift Dev Journal 6 Oct 17, 2022
SwiftUI Projects from Udemy SwiftUI Masterclass

SwiftUI Masterclass Repos: AsyncImage (N/A) Fructus (finished): an app for getting information about different fruits. Data comes from json files. Afr

Patrick Spafford 1 Mar 3, 2022
Best architecture for SwiftUI + CombineBest architecture for SwiftUI + Combine

Best architecture for SwiftUI + Combine The content of the presentation: First of the proposed architectures - MVP + C Second of the proposed architec

Kyrylo Triskalo 3 Sep 1, 2022
Weather-swiftui - An example of using SwiftUI

weather-swiftui An example of using SwiftUI Installation Get openweather api key

null 0 Jan 1, 2022