Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Adopt the Flexbox spec. It's been much improved over the past year. #87

Closed
zakdances opened this issue Aug 13, 2013 · 2 comments
Closed

Comments

@zakdances
Copy link
Contributor

This recommendation will require some pretty major additions/changes to RCL, so it's kinda "big picture" but I really think its worth considering so here I go...

For those of you who don't know what Flexbox is, here's a quick overview:

Flexbox is a new CSS3 layout module that's gone through a few revisions, but has now achieved relatively wide browser support. The latest 2012 revision (published by the W3) is here. Google offers even more info.

I've been playing around with Flexbox for a few years now. It's evolved quickly, and it's now at the point where it's become an essential part of my web toolkit. It truly is fantastic...it solves so many layout-related issues and features an easy to remember syntax.

Basically it breaks your layout into "boxes", then provides you with a ton of options for pivoting and sizing of those boxes, including being able to size based on not only pixels and percentages, but proportions to other flexboxes.

As an example, I'm going to use this recently filed issue and solve it with flexbox. Say you want to equally space 3 views inside of a parent view:

<div class="parent">
   <div class="child-a"></div>
   <div class="child-b"></div>
   <div class="child-c"></div>
</div>

now the CSS:

.parent {
   width: 800px;
   height: 200px;
   display: flex;
}
.child-a, .child-b, .child-c {
   flex: auto;
}

And that's it. Equally sized children based on parent size (which doesn't have to be static) without having to mess with weird 33% percentages.

I know that it's web tech right now (now objective c) but I really feel the Flexbox designers have done great work that can help other designers. It's worth reading over the spec. Having a cross-platform layout standard would be super cool.

I'm gonna have to think a bit more what a flexbox-liked syntax would look like in RCL/objective-c, so maybe this issue can be closed and the content moved to a working document in the RCL wiki.

Thoughts?

@jspahrsummers
Copy link
Member

Regardless of the advantages or disadvantages of Flexbox, this doesn't really seem relevant to RCL at all. RCL is all about composing signals of geometry, not about a declarative CSS-like syntax to perform layouts.

Now, it's an interesting conversation about which approach is superior, but it seems plain that this contradicts RCL's entire purpose.

@zakdances
Copy link
Contributor Author

It was unwise of me to post this without an implementation example for RCL. I'll come up with something less abstract that may be more useful then my above communication failure.

Please note: My proposal is definitely NOT to make Reactive Cocoa Layout more "CSS-like" or declaritive in any way. I understand how different a signal/stream framework is from a declarative stylesheet. I simply want to use the paint brush of our imagination to create something novel which bridges the gap between the like-minded intentions behind Flexbox and RCL; taming the layout grid to make stuff like equal spacing easier.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants