Easy to write auto layout constraints, with minimal extensions to standard namespaces.

Feature Highlights

Introduction

Constraints are added to a view using the view’s layout property, like so:

    myView.layout.width(400)

Multiple constraints are easily added by chaining calls:

    myView.layout.width(400).height(200)

A more complicated example:

    let container = UIView()
    let child = UIView()
    
    child.layout
      .fill(container, axis: .x, inset: 20)
      .center(in: container, axis: .y, priority: .high)
      .top(.lessOrEqual, to: container, offset: 100)
      .height(toWidth: 0.5)

Documentation

Constraining targets

Middle out parameters

Method Reference

Size classes

Migrating from other layout methods

If you’re coming from PureLayout…

If you’re coming from Apple’s native constraints…

Contributing

Please read the contributing guidelines

Authors

License

WWLayout is © copyright by WW International.

WWLayout is licensed under the Apache-2.0 Open Source license.