Align

3.0.0

Intuitive and powerful Auto Layout library
kean/Align

What's New

Align 3.0.0

2022-07-13T14:57:46Z
  • Breaking Change: The Alignment used in pin() method now works slightly differently by default for the pre-defined .trailing, .leading, .bottom, and .top alignments. Previously, .leading alignment would pin to the view to the .leading horizontal guide and .fill the view vertically. In Align 3.0, it centers the view vertically instead.
  • Add new documentation) created using DocC
  • Increase the minimum required Xcode version to 13.3
  • Increase the minimum supported platforms to iOS 12.0 / tvOS 12.0 / macOS 10.14
  • Rename LayoutAnchors/base to LayoutAnchors/item
  • Move Alignment to AnchorCollectionEdges/Alignment
  • Fix typos

Screen Shot 2020-06-15 at 23 06 32

Align introduces a better alternative to Auto Layout anchors.

  • Semantic. Align APIs focus on your goals, not the math behind Auto Layout constraints.
  • Powerful. Create multiple constraints with a single line of code.
  • Type Safe. Makes it impossible to create invalid constraints, at compile time.
  • Fluent. Concise and clear API that follows Swift API Design Guidelines.
  • Simple. Stop worrying about translatesAutoresizingMaskIntoConstraints and constraints activation.

To give you a taste of what the semantic APIs look like, here is an example:

view.anchors.edges.pin(insets: 20, alignment: .center)

pin edges with center alignment

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.

Screen Shot 2022-07-13 at 10 08 57 AM

Requirements

Align Swift Xcode Platforms
Align 3.0 Swift 5.6 Xcode 13.3 iOS 12.0 / tvOS 12.0 / macOS 10.14
Align 2.0 Swift 5.1 Xcode 11.0 iOS 11.0 / tvOS 11.0 / macOS 10.13

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:

  • Prefers fluent high-level APIs
  • Doesn't want to depend on big, complex libraries – Align has only ~330 lines of code
  • Prefers to have as little extensions for native classes as possible – Align adds a single property: anchors
  • Doesn't overuse operator overloads, prefers fast compile times
  • Likes NSLayoutAnchor but wishes it had simpler API which didn't require manually activating constraints

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri Aug 05 2022 17:50:51 GMT-0500 (GMT-05:00)