Skip to content

bionelabs/Grid

Repository files navigation

Grid

Make views easy by Autolayout Swift from UIKit

Code

class ViewController: UIViewController {
    
    let _view: Grid = Grid(
        .interitemSpacing(0),
        .lineSpacing(0),
        .sectionInset(UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)),
        View(
            .view(Header(text: "HEADER"), 50)
        ),
        Group(tracks: 3,
              .view(Label(text: "1"), 150),
              .view(Label(text: "2"), 50),
              .view(Label(text: "3"), 150),
              .view(Label(text: "4"), 50),
              .view(Label(text: "5"), 50)
        ),
        Group(tracks: 4,
              .square(Label(text: "75")),
              .square(Label(text: "75")),
              .square(Label(text: "75")),
              .square(Label(text: "75"))
        ),
        View(
            .view(Header(text: "HEADER"), 50)
        ),
        Group(tracks: 4,
              .square(Label(text: "75")),
              .view(Label(text: "2"), 50),
              .square(Label(text: "75")),
              .view(Label(text: "2"), 50)
        )
    )
    
    override func loadView() {
        super.loadView()
        self.view = _view
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
}

Demo

Contact

About

Make views easy by Autolayout Swift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published