Skip to content

Extremely simplified constraint component, one line of code solves constraint layout

License

Notifications You must be signed in to change notification settings

saucym/ConstraintsKit

Repository files navigation

Extremely simplified constraint component, one line of code solves constraint layout.

Requirements

  • Xcode 9.0+
  • iOS 9.0+
  • Interoperability with Swift 4.0+

Installation

CocoaPods

The preferred installation method is with CocoaPods. Add the following to your Podfile:

pod 'ConstraintsKit'
# pod 'ConstraintsKit/objc' #if you are not support swift

Quick Start

Objc

#import <ConstraintsKit/ConstraintsKit.h>

view.wy_left(button).wy_right(button).wy_top(button.bottomAnchor).offset(5).wy_height(30);

//Or like this
view
.wy_left(button)
.wy_right(button)
.wy_top(button.bottomAnchor).offset(5)
.wy_height(30);

//Or like this
[view wy_makeConstraints:^(WYConstraints *make) {
   make.wy_left(button);
   make.wy_right(button);
   make.wy_top(button.bottomAnchor).offset(5);
   make.wy_height(30);
}];        

//You can modify the height you just set
view.wy.heightConstant.constant = 50;

Swift

import ConstraintsKit

view.wy_left(button).wy_right(button).wy_top(button.bottomAnchor).offset(5).wy_height(30)
//Or like this
view.wy_makeConstraints { (make) in
    make.wy_left(button)
    make.wy_right(button)
    make.wy_top(button.bottomAnchor).offset(5)
    make.wy_height(30)
}                 

License

ConstraintsKit is MIT-licensed.

About

Extremely simplified constraint component, one line of code solves constraint layout

Resources

License

Stars

Watchers

Forks

Packages