Version First Edition
Platform iOS 13
Language Swift 5.1
Editor Xcode 11

This book will be your guide as you explore and master the many capabilities of Auto Layout.

This book is for iOS developers of all skill levels, from those just getting started building user interfaces to the experienced hands who want to get more from Auto Layout.

Take a deep dive into:

  • Interface Builder: Learn to use Interface Builder to construct and maintain your user interfaces.
  • Stack Views and Scroll Views: Learn how these special view types interact with Auto Layout and how best to utilize them in your apps.
  • Self-Sizing Views: Discover how to make your user interface dynamically adapt to its content.
  • Animating Constraints: See how to animate your Auto Layout constraints to provide feedback, focus user attention and improve navigation.
  • Adaptive Layout: Learn to use Auto Layout to make adjustments for screen size, orientation, Dynamic Type size and more.
  • Resolving Common Issues: Discover how to investigate when things go awry and learn how to resolve Auto Layout conflicts.

After completing this book, you’ll be prepared to harness the full power of Auto Layout in all of your apps.

Before You Begin

This section tells you a few things you need to know before you get started, such as what you’ll need for hardware and software, where to find the project files for this book, and more.

i

iii

iv

Section I: Beginning Auto Layout

Start your journey into Auto Layout with the foundations you need.

Get an overview of Auto Layout and how to start “thinking in Auto Layout”. Learn what constraints are and the formula that defines them. Meet other key concepts such as intrinsic content size and priorities.

1

Learn to use Xcode’s visual tool, Interface Builder, to construct a user interface complete with all Auto Layout constraints. See how to preview your interface on multiple device sizes and orientations. Then, learn to create .xib files to describe a smaller — and potentially reusable — subset of a UI.

2

Learn about UIStackView, an intelligent view container that makes many layout decisions for you. Build a complex layout using nested stack views. See how using stack views can eliminate the need for you to manually construct Auto Layout constraints.

3

Section II: Intermediate Auto Layout

Build on what you learned in Section I to begin using Auto Layout in more complex ways.

Learn how to build your user interface without using Interface Builder. Explore the Visual Format Language (VFL), which you can use to describe a set of constraints. Learn to refactor UIs built with Interface Builder into code.

4

Use scroll views to create user interfaces that go beyond the size of a physical screen. Learn about the special challenges they present when using Auto Layout and discover how to configure them.

5

Learn how to configure views that change size to account for dynamic content. See how to use Auto Layout to configure dynamically-sized cells in table views and collection views.

6

Explore using Layout Guides to create space in your layout without using empty views. Learn about the system-provided guides and how to create your own custom guides.

7

Discover what happens when the Auto Layout engine must choose between conflicting constraints. Learn how to use priorities to communicate how the system should resolve ambiguities to create the layout you want.

8

Learn to animate constraints to create unique and engaging user experiences in your apps. See how animation can provide feedback, focus user attention and improve navigation.

9

See Auto Layout’s real power come to life as you learn how to build adaptive user interfaces that adjust to screen size and orientation. Learn about traits such as layout direction, dynamic type size and size classes. Discover how trait collections allow you to build an adaptive layout without writing device-specific code.

10

Learn to make your app more accessible by supporting Dynamic Type. Understand how Auto Layout and Dynamic Type interact so you can manage layout changes in your app based on user type size preferences.

11

Learn how Auto Layout can assist you in internationalizing your app. See how to test if your app is ready for localization. Discover the things you must consider when creating your constraints to allow your app to handle other languages seamlessly.

12

Learn how to investigate when Auto Layout doesn’t give you the desired result. See how to read Auto Layout’s log messages and how to use other Xcode tools, such as symbolic breakpoints and the view debugger, to resolve Auto Layout conflicts.

13

Section III: Advanced Auto Layout

Deepen your knowledge of Auto Layout by exploring these more advanced topics.

Pull back the curtain and see the inner workings of Auto Layout. Explore the math behind the magic and discover the “why” behind the behavior of the Auto Layout engine.

14

Learn to fine-tune your app’s Auto Layout performance. Learn about best practices and about common mistakes that cost you performance.

15

Learn to use Xcode playgrounds to prototype your user interfaces. See how this technique can streamline your development process and make you more efficient.

16

Learn how to support external displays in your app. Learn to build a layout for external display, how to handle display connect and disconnect events, and how to accommodate different external display resolutions.

17

Learn how to support external displays in your app. Learn to build a layout for external display, how to handle display connect and disconnect events, and how to accommodate different external display resolutions.

18

Meet the team

Contributors

Who is this book for

This book is for iOS developers of all skill levels, from those just getting started building user interfaces to the experienced hands who want to get more from Auto Layout.

Concepts covered in this book

  • Interface Builder
  • Stack Views and Scroll Views
  • Self-Sizing Views
  • Animating Constraints
  • Adaptive Layout
  • Resolving Common Issues

Version history

First Edition · iOS 13, Swift 5.1, Xcode 11

v1.0 · May 15 2020 · Libranner Santos & Jayven Nhan
Pro

Auto Layout by Tutorials

By Libranner Santos & Jayven Nhan

The best book to teach you Auto Layout, Apple’s elegant solution to making your user interfaces flexible and adaptable.

Read for Free with an Ultimate Pro Subscription* * Includes this and all other books in our online library See all benefits
Buy Individually $59.99* *Includes access to all of our online reading features.
See buying options
Hide buying options

All videos. All books.
One low price.

A raywenderlich.com subscription is the best way to learn and master mobile development — plans start at just $19.99/month!

Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.