Expression

Expressions are passed to basic anchor methods. Full form:

( >= or <= ) item + constant ~ priority

For dimension anchors:

( >= or <= ) item * multiplier + constant ~ priority

item can be UIView, UILayoutGuide or NSLayoutAnchor. You can use / and - instead of * and +. If equality is not specified, multiplier can be put before item to be more like linear functions. More complex expressions can be created, but for simplicity, it’s not recommended.

Constraints

You can get a single constraint created from the method for later use.

let c: NSLayoutConstraint = view.bb.left().constraint

Or get all constraints accumulated from the chain.

let c: [NSLayoutConstraint] = view.bb.left().top().constraints

Activate and Deactivate

Constraints can be activated and deactivated easily so you can better control the layout change.

// Anchor methods take no arguments and align all items' corresponding anchor.
// e.g., Align all views' left.
[view1, view2, view3].bb.left()
// For dimension anchors, you can set values for all items.
// e.g., Set all views' width to 10.
[view1, view2, view3].bb.width(10)

You can distribute items along an axis with fixed spacing or equal spacing.