Masonry v0.5.0 Release Notes
-
⚡️ - Fixed bug in
mas_updateConstraints
(Rolken)Was not checking that the constraint relation was equivalent https://github.com/cloudkite/Masonry/pull/65
- Added
mas_remakeConstraints
(nickynick)⚡️ Similar to
mas_updateConstraints
however instead of trying to update existing constraints it Removes all constraints previously defined and installed for the view, allowing you to provide replacements without hassle.https://github.com/cloudkite/Masonry/pull/63
- Added Autoboxing for scalar/struct attribute values (nickynick)
Autoboxing allows you to write equality relations and offsets by passing primitive values and structs
make.top.mas_equalTo(42); make.height.mas_equalTo(20); make.size.mas_equalTo(CGSizeMake(50, 100)); make.edges.mas_equalTo(UIEdgeInsetsMake(10, 0, 10, 0)); make.left.mas_equalTo(view).mas_offset(UIEdgeInsetsMake(10, 0, 10, 0));
0️⃣ by default these autoboxing macros are prefix with
mas_
If you want the unprefixed version you need to addMAS_SHORTHAND_GLOBALS
before importing Masonry.h (ie in your Prefix.pch)https://github.com/cloudkite/Masonry/pull/62
- Added ability to chain view attributes
Composites are great for defining multiple attributes at once. The following example makes top, left, bottom, right equal to
superview
.make.edges.equalTo(superview).insets(padding);
However if only three of the sides are equal to
superview
then we need to repeat quite a bit of codemake.left.equalTo(superview).insets(padding); make.right.equalTo(superview).insets(padding); make.bottom.equalTo(superview).insets(padding); // top needs to be equal to `otherView` make.top.equalTo(otherView).insets(padding);
This change makes it possible to chain view attributes to improve readability
make.left.right.and.bottom.equalTo(superview).insets(padding); make.top.equalTo(otherView).insets(padding);