Flexbox in Swift, using Facebook's css-layout.
Swift Objective-C
Latest commit 63d2791 Oct 3, 2016 @joshaber committed on GitHub Merge pull request #25 from steadicat/swift-3.0
Swift 3.0
Permalink
Failed to load latest commit information.
External Added css-layout. Feb 2, 2015
Generated Copy the generated files out. Feb 2, 2015
SwiftBox.xcodeproj Swift 3.0 Oct 2, 2016
SwiftBox Swift 3.0 Oct 2, 2016
SwiftBoxDemo Fix SwiftBoxDemo Apr 12, 2015
SwiftBoxTests Swift 3.0 Oct 2, 2016
.gitattributes Generated is vendored. Apr 17, 2015
.gitmodules Added css-layout. Feb 2, 2015
LICENSE LICENSE Feb 2, 2015
README.md Specify Row direction. Mar 3, 2015

README.md

SwiftBox

A Swift wrapper around Facebook's implementation of CSS's flexbox.

Example

let parent = Node(size: CGSize(width: 300, height: 300),
                  childAlignment: .Center,
                  direction: .Row,
                  children: [
    Node(flex: 75,
         margin: Edges(left: 10, right: 10),
         size: CGSize(width: 0, height: 100)), 
    Node(flex: 15,
         margin: Edges(right: 10),
         size: CGSize(width: 0, height: 50)),
    Node(flex: 10,
         margin: Edges(right: 10),
         size: CGSize(width: 0, height: 180)),
])

let layout = parent.layout()
println(layout)

//{origin={0.0, 0.0}, size={300.0, 300.0}}
//  {origin={10.0, 100.0}, size={195.0, 100.0}}
//  {origin={215.0, 125.0}, size={39.0, 50.0}}
//  {origin={264.0, 60.0}, size={26.0, 180.0}}

Alternatively, you could apply the layout to a view hierarchy (after ensuring Auto Layout is off):

layout.apply(someView)

See SwiftBoxDemo for a demo.