Modern Auto Layout
Building Adaptive Layouts For iOS
-
- USD 39.99
-
- USD 39.99
Publisher Description
Why is Auto Layout so hard?
See how many of these you recognize:
• Not sure when your layout is done or how many constraints you need?
• Feel like you’re randomly adding and removing constraints to get close to the layout you want?
• Changing content hugging and compression priorities but not sure why?
• Not sure what to do about conflicting constraints and a wall of debug text dumped to the console?
• Got a layout working on the iPhone but it looks terrible on the iPad and breaks on that tiny iPhone SE screen?
• You want to add dynamic type for your users but there’s no way that super-gigantic text is going to fit.
You can try to work logically. But… adding constraints still feels like guesswork. Where do you start? When is it done?
Learning Auto Layout can make your head spin. But it doesn’t have to be that way…
Modern Auto Layout
Let me teach you modern auto layout:
• The key principles you need to know: We start with topics often ignored. Learn how the view layout system works. The fundamental principles that turn Auto Layout into something predictable you can understand. Learn what constraints you need to fully size and position a view. How to create them. Where to add them. How many you need.
• Create constraints the easy way: Auto Layout has changed a lot. Learn Modern Auto Layout with layout anchors and guides, stack views, safe areas, and size classes. Flexible layouts. Less work. Less boilerplate. (No you don’t need to learn the Visual Format Language).
• Take your pick - code or Interface Builder: Learn to create layouts in Interface Builder and programmatically. Use what works for you but know how to switch when you have to.
• Learn by doing: Practice makes perfect. Sharpen your Auto Layout skills with challenges that get you solving common layouts. Hints And Tips when you need them. Compare with my solution when you’re done.
• Your users will thank-you: Go the extra mile. Support dynamic type. Use layout variations, scrolling, and self-sizing table view cells. Create layouts that work from the smallest iPhone to the largest iPad.
• Fully updated for Xcode 16, Swift 6 and iOS 18. Over 80 sample Xcode projects to download including full solutions to the layout challenges.
What’s In The Book?
The first part of the book covers the fundamentals of Auto Layout. The key concepts that make it work and the tools to apply it to your layouts:
• Layout before Auto Layout: We start by looking at how we did layout before Auto Layout, manually managing the frames of views and relying on autoresizing or when that’s insufficient, by overriding layoutSubviews. We also look at how to create an Xcode project to work without storyboards.
• Getting Started With Auto Layout: Introduces you to constraints, what they are, who owns them and how many you need to create common layouts.
• Using Interface Builder: We dive into using Interface Builder. We look at the many ways to create constraints and what the warnings and errors mean. We also have lots of useful tips and tricks to help you master Interface Builder.
• Creating Constraints In Code: You don’t have to use Interface Builder to use Auto Layout. Learn the three ways Apple gives us to create constraints in code and why you want to use layout anchors.
• Safe Areas And Layout Margins: Safe Area Layout Guides became a hot topic when Apple launched the iPhone X. Learn how to keep the system from clipping or covering your content. Learn how to use layout margins and layout guides including the keyboard guide introduced in iOS 15.
• Layout Priorities And Content Size: We cover the topics that cause many people to hate Auto Layout. The tricky concepts of