All Projects → johngarrett → HyperSwift

johngarrett / HyperSwift

Licence: GPL-3.0 license
A Swift DSL for generating HTML and CSS documents

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to HyperSwift

Reflection
DEPRECATED
Stars: ✭ 592 (+1159.57%)
Mutual labels:  swiftpm
Dikit
Dependency Injection Framework for Swift, inspired by KOIN.
Stars: ✭ 77 (+63.83%)
Mutual labels:  swiftpm
Swift Docker
Build & test your swift packages using docker - `swift docker test`
Stars: ✭ 179 (+280.85%)
Mutual labels:  swiftpm
Swift Benchmark
A swift library to benchmark code snippets.
Stars: ✭ 659 (+1302.13%)
Mutual labels:  swiftpm
Scenekit Bezier Animations
Create animations over Bezier curves of any number of points
Stars: ✭ 35 (-25.53%)
Mutual labels:  swiftpm
Swiftcrossplatformframework
Tutorial to create cross platform framework for Swift compatible with Carthage and SwiftPM
Stars: ✭ 98 (+108.51%)
Mutual labels:  swiftpm
Fiber2d
Cross-platform 2D Game Engine in pure Swift
Stars: ✭ 415 (+782.98%)
Mutual labels:  swiftpm
EggSeed
Command Line Tool for Starting Your Swift Packages with Continuous Integration
Stars: ✭ 21 (-55.32%)
Mutual labels:  swiftpm
Scenekit Scnline
Draw a tube or thick line in SceneKit
Stars: ✭ 49 (+4.26%)
Mutual labels:  swiftpm
Zewo
Lightweight library for web server applications in Swift on macOS and Linux powered by coroutines.
Stars: ✭ 1,856 (+3848.94%)
Mutual labels:  swiftpm
Imagescout
A Swift implementation of fastimage. Supports PNG, GIF, and JPEG.
Stars: ✭ 940 (+1900%)
Mutual labels:  swiftpm
Rock
With Rock you can easily install CLIs built with Swift Package Manager. Prefer vknabel/Archery and yonaskolb/Mint instead
Stars: ✭ 13 (-72.34%)
Mutual labels:  swiftpm
Materialactivityindicator
Material Activity Indicator
Stars: ✭ 109 (+131.91%)
Mutual labels:  swiftpm
Llvmswift
A Swift wrapper for the LLVM C API (version 9.0.1)
Stars: ✭ 641 (+1263.83%)
Mutual labels:  swiftpm
Swipycell
Easy to use UITableViewCell implementing swiping to trigger actions.
Stars: ✭ 230 (+389.36%)
Mutual labels:  swiftpm
Hero
Elegant transition library for iOS & tvOS
Stars: ✭ 20,547 (+43617.02%)
Mutual labels:  swiftpm
Packageconfig
A Swift Package that allows you to define configuration settings inside a Package.swift
Stars: ✭ 88 (+87.23%)
Mutual labels:  swiftpm
swift-declarative-configuration
Declarative configuration for your objects
Stars: ✭ 46 (-2.13%)
Mutual labels:  swiftpm
SwiftCV
Minimal Swift for TensorFlow OpenCV bindings
Stars: ✭ 37 (-21.28%)
Mutual labels:  swiftpm
Venice
Coroutines, structured concurrency and CSP for Swift on macOS and Linux.
Stars: ✭ 1,501 (+3093.62%)
Mutual labels:  swiftpm

HyperSwift - a HTML and CSS Generator

Swift 5.2 @garrepi

About

HyperSwift (name pending) is a DSL written purely in Swift aimed to generate HTML styled with CSS.

Main Features

  • Vertical and Horizontal stack wrappers
  • Native HTML Elements
  • CSS Stylesheet generation

Code Snippits

505 Page from garrepi.dev:

import HyperSwift

VStack(justify: .center, align: .center) {
  HStack(justify: .spaceEvenly, align: .center) {
    Image(url: "/images/error_bomb.png")
      .width(100)
      .height(100)
    Header(.header3) { "HTTP 500" }
      .font(weight: "bold", size: 40, family: "SF Mono")
  }          
  Paragraph(fiveOfiveMessage)
}
.backgroundColor(GColors.lightRed)
.textAlign(.center)
.margin(5, .percent)
.display(.flex)
.shadow(x: 20, y: 30, color: GColors.cardShadow)
.border(width: 1, color: .black)

output

CSS

To add CSS to the stylesheet, you have to call one of the functions defined in CSSExtensions.swift.
If an element has a class name, the styles will automatically be added to CSSStyleSheet.swift's stylesheet.
Calling .generateStyleSheet() on CSSStyleSheet.swift will return a string containing the stylesheet.

Examples

HyperSwift is being used on garrepi.dev as we speak! Checkout the source code here.

Usage

in your Package.swift:

. . .
.package(url: "https://github.com/johngarrett/HyperSwift", .branch("main")),
. . .

Contributing

I would love help with this -- there's a lot that needs to get done.

I have little free time and an even little-er ability to focus on one project. Feel free to send in a PR with ideas, suggestions, or actual code!

reach out to me on twitter if you have questions I can answer

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].