Home

Awesome

logo

<p align="left"> <img src="https://img.shields.io/badge/platforms-iOS%2C%20tvOS%2C%20macOS-lightgrey.svg?colorA=28a745"> </p>

The best way to create constraints in code.

Example usage:

// Core API
view.anchors.top.equal(superview.top)
view.anchors.width.equal(view.anchors.height * 2)

// Semantic API
view.anchors.edges.pin(insets: 20) // Pins to superview
view.anchors.edges.pin(to: superview.safeAreaLayoutGuide, insets: 20)
view.anchors.width.clamp(to: 10...40)

And here's something a bit more powerful:

view.anchors.edges.pin(insets: 20, alignment: .center)
<img src="https://user-images.githubusercontent.com/1567433/84931836-5cb7e400-b0a1-11ea-8342-ce76b151fcad.png" alt="pin edges with center alignment" width="331px"/>

Documentation

The documentation for Align is created using DocC and covers all of its APIs in a clear visual way. There is also a cheat sheet available that lists all of the available APIs.

<a href="https://kean-docs.github.io/align/documentation/align/"> <img alt="Screen Shot 2022-07-13 at 10 08 57 AM" src="https://user-images.githubusercontent.com/1567433/178755429-9420d25e-dad1-4e61-9a22-04139c5746e6.png" width="858px"> </a>

Requirements

AlignSwiftXcodePlatforms
Align 3.3Swift 5.10Xcode 15.3iOS 14, tvOS 14, macOS 10.16
Align 3.0Swift 5.6Xcode 13.3iOS 12, tvOS 12, macOS 10.14

Why Align

Align strives for clarity and simplicity by following Swift API Design Guidelines. Although most of the APIs are compact, it is a non-goal to enable the most concise syntax possible.

Align is for someone who: