Auto Layout Fundamentals

12 Episodes

Episode 1

01:57

Welcome to Auto Layout Fundamentals

Welcome to Auto Layout Fundamentals. In this series, you'll learn about the fundamental concepts that power Auto Layout. At the end of this series, you'll have a solid understanding of Auto Layout and how you can use it in your projects.

Episode 2

05:17

What Is Auto Layout

Before I discuss the benefits of Auto Layout, I'd like to take a moment to discuss the options you have for creating user interfaces on iOS. Every view in the view hierarchy of a user interface needs to have a size and a position.

Episode 3

04:41

Creating a Layout With Auto Layout

In this episode, we get our feet wet by creating a very basic user interface using Auto Layout. I'm going to use Xcode 9 in this episode, but Xcode 8 should work just as well.

Episode 4

03:20

Anatomy of a Constraint

In this episode, I'd like to take a moment to discuss the anatomy of a constraint, the fundamental building block of a user interface driven by Auto Layout. Remember that user interfaces created with Auto Layout define constraints. The constraints describe the relationships between the views in the user interface. The Auto Layout engine then inspects these constraints and calculates the frame of every view in the view hierarchy.

Episode 6

03:50

Implicit and Explicit Constraints

In this episode, we take a look at implicit and explicit constraints. It's a topic worth covering because it frequently trips up developers new to Auto Layout.

Episode 7

06:46

What Is Intrinsic Content Size

In this episode, we take a close look at another important concept of Auto Layout, intrinsic content size. We first take a moment to discover what intrinsic content size is. Later in the episode, we also touch upon content hugging and content compression resistance, two concepts that drive user interfaces created with Auto Layout.

Episode 10

05:20

What Are Layout Guides

In this episode, I'd like to take a minute to discuss layout guides. While there are several layout guides, the ones I discuss in this episode are the top layout guide, the bottom layout guide, and the safe area layout guide. The top and bottom layout guide are deprecated as of iOS 11 and tvOS 11. They have been replaced with the brand new safe area layout guide.

Episode 11

06:53

Working With Stack Views

In this episode, I want to spend a few minutes talking about a special class that was introduced in iOS 9 and tvOS 9, UIStackView. Even though UIStackView is a UIView subclass, the stack view itself is not rendered. Only its contents are rendered to the screen. That's the first important feature of the UIStackView class.

Episode 12

05:45

Best Practices and Common Pitfalls

I'd like to end this series with a few tips and best practices for using Auto Layout in your projects. Along the way, I'll also point out common pitfalls when using Auto Layout and how to avoid them.