web

1.0.0-beta.3.2.0

🧱 Write your website in pure Swift with power of webassembly. DOM, CSS and all the WebAPIs are available out of the box.
swifweb/web

What's New

🖥 `DOM.print` method

2023-03-31T17:26:42Z

Normally you can't use print inside of the @DOM since it is a function builder which takes DOM elements, it is not regular function

@DOM override var body: DOM.Content {
    // you can't use print statements here, it is not regular function
    // if/else, if let, guard let statements are not like in regular functions
}

But now it is possible to print inside of the @DOM this way

let hello: String? = nil

@DOM override var body: DOM.Content {
    if let hello = self.hello {
        DOM.print("hello is not null: \(hello)")
    } else {
        DOM.print("hello is null")
    }
}

SwifWeb

MIT License Swift 5.7 Swift.Stream

This library provides DOM, CSS and all possible web APIs beautifully wrapped into Swift ❤️

With it you will easily build your awesome reactive web app in beloved Swift ❤️

Installation

Go to webber repository and install it.

Usage

Just execute webber new to create new spa or pwa project.

Go to the project folder and open Package.swift to explore the code.

Then execute webber serve or webber serve -t pwa -s Service for the pwa app to debug your project in the browser.

Then take a look at the hidden .webber folder, you will find the entrypoint/dev folder where webber just generated entry files, you could edit these files if swift is not enough, e.g. to make you custom loading bar.

To release the project just call webber release or webber release -t pwa -s Service for pwa, and then grab production files from .webber/release folder.

Please find examples in releases.

Description

  • Swift Tools 5.7.0
View More Packages from this Author

Dependencies

Last updated: Wed Mar 27 2024 01:24:13 GMT-0900 (Hawaii-Aleutian Daylight Time)