GithubHelp home page GithubHelp logo

cbuilder's Introduction

CBuilder

Screen Shot 2019-08-28 at 22 25 25

Swift Build Status

✨ Super sweet syntactic sugar for Constraints in UIKit.

✨ A Swift Autolayout DSL for iOS

At a Glance

Before

//In your controller
let myView = View()

view.addSubview(myView)

    
 myView.translatesAutoresizingMaskIntoConstraints = false
       
 NSLayoutConstraint.activate([
            myView.topAnchor.constraint(equalTo: self.view.topAnchor),
            myView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
            myView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
            myView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor)
       ])
}

Then:

view.addSubview(myView)
myView.cBuild(make: .fillSuperview)

Small Advantages

  • You can use closure to construct the constraint to your view.

    label.cBuilder {
            $0.leading.equal(to: leadingAnchor, offsetBy: 20)
            $0.top.equal(to: topAnchor, offsetBy: 10)
        }
  • Want to set your constraints with your own types? Just make that

    label.cBuild(top: topAnchor, bottom: bottomAnchor, left: leadingAnchor, right: trailingAnchor) 
  • A lot times you have set the view in center to super view, so...

    label.cBuild(make: .centerInSuperView)

Installation

  1. Clone project
  2. Open your Xcode, select a simulator, click the play button or cmd + R
  3. Test in your cases, and don't worry to use TranslateAutoRezingsMas.............................

License

CBuilder is under MIT license. See the LICENSE file for more info.

cbuilder's People

Contributors

viniciusdeep avatar

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.