Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kean/Align
Intuitive and powerful Auto Layout library
https://github.com/kean/Align
anchors autolayout constraints
Last synced: 3 months ago
JSON representation
Intuitive and powerful Auto Layout library
- Host: GitHub
- URL: https://github.com/kean/Align
- Owner: kean
- License: mit
- Created: 2017-11-07T17:44:34.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T17:56:01.000Z (7 months ago)
- Last Synced: 2024-05-02T16:18:39.556Z (6 months ago)
- Topics: anchors, autolayout, constraints
- Language: Swift
- Homepage:
- Size: 2.7 MB
- Stars: 352
- Watchers: 12
- Forks: 18
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - Yalta - An intuitive and powerful Auto Layout library. (Layout / Other Hardware)
- awesome-macos-libraries - Align - Intuitive and powerful Auto Layout library. Language: Swift. (Layout)
- awesome-ios - Align
- awesome-ios-star - Yalta - An intuitive and powerful Auto Layout library. (Layout / Other Hardware)
README
![logo](https://user-images.githubusercontent.com/1567433/178810472-8b5f687e-ed7f-491c-99ed-e86e563462ef.png)
The best way to create constraints in code.
- **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](https://swift.org/documentation/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:
```swift
view.anchors.edges.pin(insets: 20, alignment: .center)
```## Documentation
The [**documentation**](https://kean-docs.github.io/align/documentation/align/) for Align is created using DocC and covers all of its APIs in a clear visual way. There is also a [**cheat sheet**](https://github.com/kean/Align/blob/master/Sources/Align.docc/Resources/align-cheat-sheet.pdf) available that lists all of the available APIs.
## Requirements
| Align | Swift | Xcode | Platforms |
|----------------|-------------|-------------------|----------------------------------|
| Align 3.2 | Swift 5.8 | Xcode 14.3 | iOS 13.0, tvOS 13.0, macOS 10.15 |
| 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](https://swift.org/documentation/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](https://github.com/robb/Cartography/issues/215)
- Likes [NSLayoutAnchor](https://developer.apple.com/library/ios/documentation/AppKit/Reference/NSLayoutAnchor_ClassReference/index.html) but wishes it had simpler API which didn't require manually activating constraints