cbu

CBuilder

🧑 A Swift Autolayout DSL for iOS πŸ“πŸ“πŸ–Œ

Showing:

Popularity

Downloads/wk

0

GitHub Stars

43

Maintenance

Last Commit

1yr ago

Contributors

8

Package

Dependencies

0

License

MIT

Categories

Readme

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: view.topAnchor),
            myView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
            myView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
            myView.trailingAnchor.constraint(equalTo: 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.............................

    CocoaPods

    # Podfile
    use_frameworks!
    
    target 'YOUR_TARGET_NAME' do
        pod 'CBuilder'
    end
    

    Replace YOUR_TARGET_NAME and then, in the Podfile directory, type:

    $ pod install
    

License

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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100