Skip to content

ahmedragab/NSLayoutConstraint-Equations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

NSLayoutConstraint-Equations

Swift library to create Auto Layout constraints programatically just like math equations and inequalities

Usage

view.addConstraint(Top(label) == 1 * Top(button) + 20)

view.addConstraints(Top(label) == Top(button) |+ CenterX(label) == CenterX(self.view) |+ CenterY(label) == CenterY(self.view) |+ (Bottom(button) == Bottom(self.view) + 600)|10)

use the form:

Attribute1(Item1) == multiplier * Attribute2(Item2) + constant

Attributes:

Left Right Top Bottom Leading Trailing Width Height CenterX CenterY Baseline LastBaseline FirstBaseline LeftMargin RightMargin TopMargin BottomMargin LeadingMargin TrailingMargin CenterXWithinMargins CenterYWithinMargins

you can append constraints using operator |+

also you can set priorities like Constraint|priority

About

Swift library to create Auto Layout constraints programatically just like math equations and inequalities

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages