Guiding principles and commandments of AutoLayout

These very good principles have been taken from Udacity course.

Guiding principles

  • Stack views first, constrains later
  • Start small, or not at all
  • Work from the inside out
  • Trust the simulator or device only
  • Donโ€™t panic

Seven commandments of AutoLayout

  1. Tweak the properties of the StackView
  2. Use another StackView
  3. Tweak the compression resistance or the hugging priority
  4. Add constraints to the StackView
  5. Add constraints to the views
  6. To connect views within different StackViews, use 5
  7. If everything else fails, use a filler view
Some other useful links:

WWDC 2017

WWDC 2016

WWDC 2015

Guiding principles and commandments of AutoLayout