EasyAutoLayout
Intro
EasyAutoLayout is a small framework built using the ideas presented in the article called Autolayout Micro DSL by Chris Eidhof.
I like to use this on most of my projects, it uses very little code and is a fast way to work with view coding without all the autolayout boiler plate and without having to add big external dependencies.
Usage:
import EasyAutoLayout
let view = UIView()
let label = UILabel()
view.addSubview(label, constraints: [
equal(\.leadingAnchor),
equal(\.topAnchor, \.safeAreaLayoutGuide.topAnchor),
equal(\.trailingAnchor)
])
Check the original article for more usages and code explanation.
Swift Package Manager
Note: Instructions below are for using SwiftPM without the Xcode UI. It's the easiest to go to your Project Settings -> Swift Packages and add it from there.
To integrate using Apple's Swift package manager, without Xcode integration, add the following as a dependency to your Package.swift
:
.package(url: "https://github.com/garrefa/EasyAutoLayout.git")
and then specify "EasyAutoLayout"
as a dependency of the Target in which you wish to use it.