Latest 1.0.0
Homepage https://github.com/inamiy/Flexbox
License MIT
Platforms ios 9.1, requires ARC
Authors

Swift wrapper of facebook/yoga, a cross-platform CSS Flexbox layout engine that is lightweight, runs asynchronously, and is far simpler than AutoLayout.

If you are new to CSS Flexbox, visit following links and have fun :)

Example

let node = Node(
    size: CGSize(width: 300, height: 100),
    children: [
        Node(size: CGSize(width: 20, height: 20)),
        Node(size: CGSize(width: 40, height: 80)),
        Node(size: CGSize(width: 60, height: 40)),
    ],
    flexDirection: .row,
    justifyContent: ... // .flexStart, .center, .flexEnd, .spaceBetween, .spaceAround
)

let view = ... // prepare view hierarchy

DispatchQueue.global.async {
    let layout = node.layout()

    DispatchQueue.main.async {
        layout.apply(view)
    }
}

This will result:

Flexbox

Please see FlexboxPlayground for more examples.

Acknowledgement

The original idea is from joshaber/SwiftBox.

License

MIT

Latest podspec

{
    "name": "Flexbox",
    "version": "1.0.0",
    "summary": "Swift wrapper of facebook/yoga (CSS Flexbox layout engine).",
    "homepage": "https://github.com/inamiy/Flexbox",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "inamiy": "[email protected]"
    },
    "social_media_url": "http://twitter.com/inamiy",
    "platforms": {
        "ios": "9.1"
    },
    "requires_arc": true,
    "source": {
        "git": "https://github.com/TheodoliteGroup/Flexbox.git",
        "tag": "v1.0.0",
        "submodules": true
    },
    "source_files": "{Sources,Externals/yoga/yoga}/**/*.{h,m,mm,c,swift}",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This