Skip to content

Instantly share code, notes, and snippets.

@muukii
Created July 10, 2021 07:11
Show Gist options
  • Save muukii/63379e9a8d2bc5bed865706c448fbe9c to your computer and use it in GitHub Desktop.
Save muukii/63379e9a8d2bc5bed865706c448fbe9c to your computer and use it in GitHub Desktop.

Revisions

  1. muukii created this gist Jul 10, 2021.
    24 changes: 24 additions & 0 deletions UsingMondrianClassicalLayoutAPI.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    let backgroundView = UIView.mock(backgroundColor: .neon(.violet))
    let box1 = UIView.mock(backgroundColor: .neon(.red), preferredSize: .largeSquare)
    let box2 = UIView.mock(backgroundColor: .neon(.yellow), preferredSize: .largeSquare)

    view.addSubview(backgroundView)
    view.addSubview(box1)
    view.addSubview(box2)

    mondrianBatchLayout {

    backgroundView.mondrian.layout.edges(.toSuperview)

    box1.mondrian.layout
    .top(.toSuperview, 10)
    .left(.toSuperview, 10)
    .bottom(.toSuperview, -10)

    box2.mondrian.layout
    .top(.toSuperview, 10)
    .left(.to(box1).right, 10)
    .right(.toSuperview, -10)
    .bottom(.toSuperview, -10)

    }