🚂
.
🚃
.
🚋
Constren Make trains of constraints with style!
button.constren.centerY()
.lead(spacing: 16)
.trail(image.leadingAnchor, spacing: 64)
.height(100, relation: .greaterThan)
Constren is an easy to use, easy to read layout tool for UIKit
Requirements
- iOS 10.0+
- Xcode 10.0+
- Swift 4.0+
Installation
Cocoapods
To add Constren into your project using CocoaPods, add it in your Podfile:
pod 'Constren', :git => 'https://github.com/dorvk/Constren.git'
Carthage
To add Constren into your project using Carthage, specify it in your Cartfile:
github "dorvk/Constren"
Manually
Add the Sources folder into your project.
Example
import Constren
let imageView = UIImageView()
view.addSubview(imageView)
imageView.constren.top() // default is equalToSuperview with 0 spacing
.lead(spacing: 16) // you can add spacing
.trail(label.leadingAnchor, spacing: 16)
.height(100, relation: .greaterThan) // supports lessThan or greaterThan, default is equalTo
tableView.constren.fill() // shortcuts
collectionView.constren.fill(lead: 16, bot: 32)
titleLabel.constren.horizontalFill(lead: 16)
.centerY(spacing: 16)
imageView.constren.centered(x: 16)
.squared(250)