Behind the Scenes with Auto Layout or How to Solve Constraints with the Cassowary Algorithm (iOSConfSG)

Behind the Scenes with Auto Layout or How to Solve Constraints with the Cassowary Algorithm (iOSConfSG)

Auto Layout is the most powerful tool on iOS today, to support developers in creating adaptive user interfaces on iOS. The power of this great technology lies in how simple its foundations are. The engineers behind Auto Layout at Apple started to reveal more of the internals of their technology recently, to help us understand its principles better, in order to get the best performance out of our layout code. Let’s look more closely at how the Auto Layout engine solves constraints through exploring the Cassowary algorithm, that’s running under the hood, turning constraints into linear equations, and solving them. By doing the math ourselves, we’ll have a better understanding of what layouts are easier, or more difficult to satisfy. What coding practices can help us achieve best Auto Layout performance.

6190e163993110536deb0767f9f63fdb?s=128

Agnes Vasarhelyi

January 18, 2019
Tweet