Remember Auto Layout? All the pain it caused you. All those long hours of figuring out how to set up constraints properly in storyboard. I do. You’re not the only one that is sick and tire of configuring Auto Layout constraints. In fact, every semester I taught iOS development @ University of Southern California, Auto Layout has been voted unanimously as the least favorite topic among my students.
This is because modern apps generally have a lot of views, and with Auto Layout you create this web of relationships among every single view on the screen. And when one tiny constraint doesn’t resolve properly, it causes a chain reaction of all the other constraints to also have errors, and you end up with something like this:
The pain is real. It has been felt by every iOS engineer. Luckily, Apple has listened to our concerns; they introduced a UI component that will take away our Auto Layout frustrations once and for all, and make iOS development fun again!
Introduced in iOS 9, stack views dramatically simplifies building responsive layouts. Apple highly encourages developers to use stack views, and not waste any more hours configuring Auto Layout constraints for each individual view.
In the following 2 videos, I’ll be going in depth on how stack views work.
Part 1 is an overview, and part 2 is a demo in storyboard.
Hope you enjoy!
My complete iOS Foundations course officially launched @ Udemy. For this course, I’ve taken the best of my 5+ years of teaching at USC and General Assembly, and teach you how to build from the ground up Lyft + Spotify.
You can find it over @ https://bit.ly/3cYFFWz