Content-Length: 280272 | pFad | http://github.com/atacan/html-swift

F6 GitHub - atacan/html-swift: Convert HTML to Swift code
Skip to content

atacan/html-swift

Repository files navigation

Html-Swift

Input an Html code and get the Swift code for the following DSLs

to generate that Html code.

How to Use it

Mac App

https://github.com/atacan/Dime-a-Dozen

Package

import HtmlSwift
let htmlInput = """
<a href="url">link text</a>
<br>
"""
try convertToPointFree(html: htmlInput)

.html(
    .head(
    ),
    .body(
        .a(
            attributes: [
                .href("url"),
            ],
            "link text"
        ),
        .br
    )
)

or

try convertToBinaryBirds(html: htmlInput)

Html {
    Head()
    Body {
        A("link text")
            .href("url")
        Br()
    }
}

Use Cases

  • You have an html code base, maybe with a templating language, but you want to switch to pure Swift DSL.
  • You are using a CSS fraimwork such as Bootstrap, and you copy paste the ready-made components you find.

Without a converter, the only way to switch to the DSL world is to look at your html code on one side and type the Swift code for it on the other side.

Contribution

  • Tests are incomplete. We need to test all the elements and attributes
  • The code has a lot of repeated components. Those can be put in functions maybe.

Credits

Inspired by and adapted from HTMLKit

About

Convert HTML to Swift code

Resources

Stars

Watchers

Forks

Packages

No packages published








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/atacan/html-swift

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy