FluidGroup / MondrianLayout

🏗 A way to build AutoLayout rapidly than using InterfaceBuilder(XIB, Storyboard) in iOS.
https://medium.com/geekculture/describing-autolayout-with-imaginable-how-it-lays-out-programmatically-mondrianlayout-71efe82f3149
MIT License
168 stars 11 forks source link

Feature Request: Support size equalities in views / layoutGuides #47

Closed JohnEstropia closed 3 years ago

JohnEstropia commented 3 years ago

Sample syntax:

button2.mondrian.buildSelfSizing {
    $0.width(.like(button1), .exact(0)).height(.like(button1), .exact(0))
}
button1.mondrian.buildSelfSizing {
    $0.minWidth(60).minHeight(44)
}
muukii commented 3 years ago

you're talking about Classic layout API? it's could be better to start describing with view.mondrian.layout. then, view.mondrian.layout has horizontal, edge. so how do you think about adding like in addition.

(currently available)

box1.mondrian.layout.horizontal(.toSuperview).activate()

(example syntax to achieve that you're requesting feature)

button2.mondrian.layout.like(.to(button1)).activate()

I'm not pretty sure like is good naming against .to() or .toSuperview

JohnEstropia commented 3 years ago

button2.mondrian.layout.like(.to(button1)).activate()

What if we only need either width or height to be match, but not both?

muukii commented 3 years ago

what if you need width to be match. it's gonna be following.

button1.mondrian.layout.width(.to(button2).width).activate()

did I answer?

muukii commented 3 years ago

that's been available from this PR

https://github.com/muukii/MondrianLayout/pull/45

JohnEstropia commented 3 years ago

Sorry, I didn't know that UILayoutGuides are already supported there. Thanks, closing this ticket now