Mastering Auto Layout with EasyPeasy I: Introduction

Carlos Vidal
1 min readFeb 11, 2017

--

Welcome to this series of tutorials that will teach you Auto Layout from the very basics to the most complex tasks you may find laying out your views. Despite of just covering working programmatically with NSLayoutConstraints most of the content can be extrapolated to working with Interface Builder.

EasyPeasy

Instead of speaking pure UIKit we will use EasyPeasy. There is a good bunch of popular Auto Layout libraries that provide syntactic sugar making AL simpler, like SnapKit, Cartography or PureLayout, so, why EasyPeasy?

  • Simplicity: provides a concise but powerful domain specific language.
  • Auto Layout on steroids: offers some other additional features like conflict resolution, conditional application of constraints, trait collections support, update of constraints without keeping references and a neat debugging mode.
  • Reliability: Maybe due to its 100% code coverage in almost 1 year of life no real bugs have been reported despite of the 120 CocoaPods installs and 190 repository clones (numbers per week).

But if that is not enough this is a short comparison of the libraries mentioned above:

Next

We will layout the contents of a simple view, understand how EasyPeasy’s conflict resolution works and update the constant of a constraint.
Mastering Auto Layout with EasyPeasy II: Basics

Apply here.

--

--