Implementing autolayout constrains programmatically made dead simple.
import Caliber
// Setup view and add to a superview.
let aView = UIView()
aView.backgroundColor = UIColor.red
view.addSubview(aView)
// Add Constraints
aView.caliber .top(with: view, .top)
.centerHorizontally(in: view)
.width = 100
aView.caliber.aspect = 16/9
// That's All.
- Xcode 9.0 or newer
- Swift 4.0
use_frameworks!
pod 'Caliber'
- Download the repo
- ⌘C ⌘V the Caliber.swift file into your project
- In your Project's Info go to 'Build Phases'
- Open 'Compile Sources' and add Caliber.swift
Caliber is released under the MIT License.