Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

LinkedIn Learning

iOS Development: Auto Layout Programmatically

via LinkedIn Learning


Learn how to use Auto Layout programmatically to create user interfaces for multiple iOS devices.

Auto Layout offers a constraint-based design approach that allows iOS developers to create user interfaces for multiple devices. If you're using Swift Playgrounds or need portable and modular code, programmatic Auto Layout is your prime choice. In this course, instructor Steven Lipton talks about the different options you have to create constraints programmatically in Swift—and how to use each one. He also shows how to use size classes, stack views, and priorities for the fastest, most adaptable UI on any iOS device.


  • Welcome
  • What you should know
  • Warming up the simulators
  • Using the exercise files
1. Basic Concepts in Auto Layout
  • Views and frames
  • Why use programmatic Auto Layout?
  • Understand pins, aligns, and sizes
  • Errors in Auto Layout
  • Challenge: Planning Auto Layout
  • Solution: Planning Auto Layout
  • The Auto Layout notation
2. Coding Constraints
  • Basic preparation
  • Pin and size individual constraints
  • Anchors and the safe area
  • Align views
  • Errors in Auto Layout
  • Size views with multipliers
  • Aspect ratio with multipliers
  • Challenge: Oatmeal
  • Solution: Oatmeal
3. The Visual Format Language
  • Prepare for the Visual Format Language
  • Visual Format basics
  • Visual Format pin constants
  • Alignment and multiple constraints
  • Use sizes with Visual Format
  • Metrics, margins, and anchors
  • Errors in Visual Format
  • Challenge: Peanut butter
  • Solution: Peanut butter
4. Stack Views
  • Add a stack view
  • The alignment property and size
  • The distribution property and size
  • Images in stack views
  • Nest stack views
  • Challenge: Spring rolls
  • Solution: Spring rolls
5. Advanced Layout
  • Embed subviews
  • Add constraints to subviews
  • Add Visual Format Language to subviews
  • Intrinsic content size
  • Inequalities in constraints
  • Priorities in coded constraints
  • Size ranges in Visual Format
  • Challenge: Pasta
  • Solution: Pasta
6. Size Classes
  • Why use size classes?
  • Trait collections
  • Determine the size class
  • Dynamic trait changes on iPhone
  • Dynamic trait changes on iPad
  • Dynamic trait changes on iPad (continued)
  • Challenge: Cake
  • Solution: Cake
  • Next steps

Taught by

Steven Lipton

Related Courses


Start your review of iOS Development: Auto Layout Programmatically

Never Stop Learning!

Get personalized course recommendations, track subjects and courses with reminders, and more.

Sign up for free