Latest 0.0.1
Homepage https://github.com/marcbaldwin/Alto
License MIT
Platforms ios 8.0, requires ARC
Frameworks Foundation, UIKit
Authors

Create layouts that support every device and orientation.

Under Development

Alto is still being developed. A stable version will be released very soon. Star or Watch to keep updated with the progress :)

Aims

Alto was developed to be:

Readable

// Align the center of titleLabel 40px from the top of the container
titleLabel.set(.centerY, .equalTo, containerView, .top + 40)

// Align the centers of titleLabel and subtitleLabel to the container
[titleLabel, subtitleLabel].set(.centerX, .equalTo, containerView, .centerX)

Compile Safe

This compiles but will cause a crash

NSLayoutConstraint(item: titleLabel, attribute: .height, relatedBy: .equal, toItem:
containerView, attribute: .centerX, multiplier: 1.0, constant: 0.0)

This does not compile :)

titleLabel.set(.height, .equalTo, containerView, .centerX) <-- Error

Fast and Simple

  1. Small API
    • Convenience attributes to reduce code needed, see features
    • No operator overloads which can increase compile time

Well Documented

View the examples and diagrams [coming soon]()

Features

Extra Attributes

Such as: .center, .size, .edges, .topLeft

titleLabel.set(.center, .equalTo, containerView, .center)
titleLabel.set(.topLeft, .equalTo, containerView, .bottomRight)
titleLabel.set(.edges, .equalTo, containerView, .edges - 5)

View Grouping

Apply the same constraints to many views

[titleLabel, subtitleLabel].set(.center, .equalTo, containerView, .center)

Stack Layouts

Create UIStackView style layouts just using constraints

views.stack(.vertically, margin: 20)
views.stack(.vertically, in: containerView, margin: 20)

Clear Priorities

titleLabel.set(.width, .greaterThanOrEqualTo, containerView, .width, priority: .low)

Todo List

  1. Size Classes
  2. Layout Guide Support

Resources

Latest podspec

{
    "name": "Alto",
    "version": "0.0.1",
    "license": "MIT",
    "summary": "Create adaptive layouts with an expressive yet concise syntax.",
    "homepage": "https://github.com/marcbaldwin/Alto",
    "authors": {
        "marcbaldwin": "[email protected]"
    },
    "source": {
        "git": "https://github.com/marcbaldwin/Alto.git",
        "tag": "0.0.1"
    },
    "source_files": "Alto/*.swift",
    "platforms": {
        "ios": "8.0"
    },
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "requires_arc": true,
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This