iOS Development: Auto Layout Programmatically
4h 38mIntermediate2018-06-05
Authors

Steven Lipton
VP of Special Projects at Scientific Device Laboratory, Developer
Course details
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.
Learning objectives
When and why to use Auto Layout programmatically
Creating constraints in Swift
Resolving errors in Auto Layout
Using the safe area
Working with the Visual Format Language
Adding a stack view
Harnessing the power of inequalities and priorities in constraints
Understanding traits and size classes
Learning objectives
When and why to use Auto Layout programmatically
Creating constraints in Swift
Resolving errors in Auto Layout
Using the safe area
Working with the Visual Format Language
Adding a stack view
Harnessing the power of inequalities and priorities in constraints
Understanding traits and size classes
Skills covered
Cross-Platform DevelopmentiOSMobile DevelopmentAppleDeep Dive (X:Y)
Concepts
0. Introduction
- 01 - Welcome
- 02 - What you should know
- 03 - Warming up the simulators
- 04 - Using the exercise files
1. Basic Concepts in Auto Layout
- 05 - Views and frames
- 06 - Why use programmatic Auto Layout
- 07 - Understand pins, aligns, and sizes
- 08 - Errors in Auto Layout
- 09 - Challenge - Planning Auto Layout
- 10 - Solution - Planning Auto Layout
- 11 - The Auto Layout notation
2. Coding Constraints
- 12 - Basic preparation
- 13 - Pin and size individual constraints
- 14 - Anchors and the safe area
- 15 - Align views
- 16 - Errors in Auto Layout
- 17 - Size views with multipliers
- 18 - Aspect ratio with multipliers
- 19 - Challenge - Oatmeal
- 20 - Solution - Oatmeal
3. The Visual Format Language
- 21 - Prepare for the Visual Format Language
- 22 - Visual Format basics
- 23 - Visual Format pin constants
- 24 - Alignment and multiple constraints
- 25 - Use sizes with Visual Format
- 26 - Metrics, margins, and anchors
- 27 - Errors in Visual Format
- 28 - Challenge - Peanut butter
- 29 - Solution - Peanut butter
4. Stack Views
- 30 - Add a stack view
- 31 - The alignment property and size
- 32 - The distribution property and size
- 33 - Images in stack views
- 34 - Nest stack views
- 35 - Challenge - Spring rolls
- 36 - Solution - Spring rolls
5. Advanced Layout
- 37 - Embed subviews
- 38 - Add constraints to subviews
- 39 - Add Visual Format Language to subviews
- 40 - Intrinsic content size
- 41 - Inequalities in constraints
- 42 - Priorities in coded constraints
- 43 - Size ranges in Visual Format
- 44 - Challenge - Pasta
- 45 - Solution - Pasta
6. Size Classes
- 46 - Why use size classes
- 47 - Trait collections
- 48 - Determine the size class
- 49 - Dynamic trait changes on iPhone
- 50 - Dynamic trait changes on iPad
- 51 - Dynamic trait changes on iPad (continued)
- 52 - Challenge - Cake
- 53 - Solution - Cake
Conclusion
- 54 - Next steps