Giter Site home page Giter Site logo

flexbox's Introduction

Flexbox

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:

Please see FlexboxPlayground for more examples.

Acknowledgement

The original idea is from joshaber/SwiftBox.

License

MIT

flexbox's People

Contributors

inamiy avatar ocrickard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flexbox's Issues

Cocoapods?

I want to include this in my Theodolite pod, so I'm planning on forking to add the podspec for now, but any chance you'd mind adding a pod?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.