Convert HTML to Swift code
🕓 2 weeks ago
.package(url: "https://github.com/atacan/html-swift.git", from: "2.0.2")
Input an Html code and get the Swift code for the following DSLs
to generate that Html code.
How to Use it
let htmlInput = """
<a href="url">link text</a>
try convertToPointFree(html: htmlInput)
try convertToBinaryBirds(html: htmlInput)
- 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 framework 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.
- 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.
Inspired by and adapted from HTMLKit