Skip to content

Repository files navigation

CSSLayout is a tiny Swift wrapper around Facebook's css-layout framework.

Basic Usage

Imagine a simple UIView, with two subviews (represented as containerNode, childNode and otherChildNode below).

letcontainerNode=CSSNode(flexDirection: CSSFlexDirectionColumn, alignItems: CSSAlignCenter)letchildNode=CSSNode(size:CSSSize(width:50, height:50))letotherChildNode=CSSNode(alignSelf: CSSAlignStretch)
containerNode.children =[childNode, otherChildNode]letcomputedLayout= containerNode.layout()
// At this point, computedLayout can be used to set the frames of the views represented by these nodes.
container.frame = computedLayout.frame
child.frame = computedLayout.children[0].frame
otherChild.frame = computedLayout.children[1].frame

About

Swift wrapper around Facebook's css-layout

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages