To add EasyPeasy as a dependency to your project, just add the following line to your Cartfile:. Applying a constraint to an UILayoutGuide is as easy as we have discussed in the previous sections, just apply the EasyPeasy attributes you want using the easy. EasyPeasy provides as many Attribute classes as attributes NSLayoutConstraint have, plus something that we have called CompoundAttributes we will explain these attributes later.
|Date Added:||24 October 2012|
|File Size:||12.67 Mb|
|Operating Systems:||Windows NT/2000/XP/2003/2003/7/8/10 MacOS 10/X|
|Price:||Free* [*Free Regsitration Required]|
Alternatively, you can play with EasyPeasy cloning the Playground project available here. Because they behave like the NSLayoutConstraint attributes, you can find a complete description of them in the Apple docs.
Fast and hassle-free update of constraints. There is a custom operator that eases the creation of a NSLayoutConstraint multiplier. Without really knowing it, we have just created an EasyPeasy Constant struct containing the constant, multipler and the relation of a NSLayoutConstraint.
Instead, a Context struct ewsy passed as parameter providing some extra information based on the UITraitCollection of the UIView the Attributes are going to be applied to. The framework has been tested with Xcode 7 and Swift 2.
One of the peculiarities of EasyPeasy is the usage of Conditions or closures that evaluate whether a constraint should be applied or not to the view. EasyPeasy is Carthage compatible. EasyPeasy is a well documented framework and therefore all the documented classes and methods are available in Cocoadocs. To install it, simply add the following line to your Podfile: You can create an Auto Layout relationship between your view DimensionAttribute and another view by using the method func like view: In addition, you can combine multipliers with Equal.
EasyPeasy is available through CocoaPods. Condition sets the Condition closure to an Attribute. This iOS only feature is a variant of the Condition closures that receive no parameters and return a boolean value. To install it, simply add the following line to your Podfile:. That line of 11.7 will create a constraint that sets a width for contentLabel equal to the headerView width. You can manage these from the easy property available within all the UI classes that work with Auto Layout view subclasses, layout guides, etc.
In the previous example, two attributes have been applied and therefore two constraints created and added: In order to apply any of these priorities to an Attributethe method.
There are just two dimension attributes Width and Height. To work with Swift 4 use EasyPeasy v. We briefly mentioned in the introductory section that EasyPeasy solves most of the constraint conflicts and it's true.
These Condition closures can be re-evaluated during the lifecycle of a view, to do so you just need to call the convenience method easy. Conditional application of constraints. You can also apply a Condition to an array of Attributes this operation will override the Conditions previously applied to an Attribute.
Resolution of Auto Layout conflicts. However, there is some cases in which EasyPeasy cannot prevent a conflict at least for now. As we have seen before, you can re-evaluate a Condition closure by calling the easy. EasyPeasy is a set of position and dimension attributes that you can apply to your views. The example below is pewsy simple but shows how effortless its implementation result using EasyPeasy.
Obsolete Junk easypeasy-project-1.7-20090924-171003 series
These attributes are the ones that create multiple DimensionAttributes or PositionAttributes under the hood. Besides the basics, EasyPeasy resolves most of pewsy constraint conflicts for you and also can attach to a constraint conditional closures that are evaluated before applying a constraint, this way you can install an Auto Layout constraint depending on platform, size classes, orientation Lightweight and easy to use domain specific language. A touch of EasyPeasy The example below is quite simple but shows how effortless its implementation result using EasyPeasy.