mamaral / Neon

A powerful Swift programmatic UI layout framework.
MIT License
4.58k stars 389 forks source link

Allow specifying xPad, yPad individually (ref #19) #21

Open brcolow opened 8 years ago

brcolow commented 8 years ago

This is my attempt at addressing the issue I raised in #19. Obviously we should add some tests for the case where xPad != yPad, but I wanted to get this out there quickly for discussion/feedback.

Notes:

Depending on the specific combination of horizontal/vertical with top/left/bottom/right, the xPad and yPad values can both affect the resulting frame, or just one of them. Keeping track of which combinations allow for xPad and/or yPad to affect the resulting frame will allow us to (if desired) breakout methods by these groups so that no method parameter is redundant.

Which padding values affect the resulting frame:

groupAgainstEdge:

Horizontal:

Vertical:

brcolow commented 8 years ago

Ping @mamaral

mamaral commented 8 years ago

My first thoughts going over this is that if we wanted to go to this extent, why not make it fully customizable for all situations, i.e. allow them to specify xPad, yPad, and spacing? Then its less ambiguous as to what you're setting, and you can lay it out however you want?

brcolow commented 8 years ago

Makes sense - thanks. I will be revising the PR soon. Thanks again for your feedback.