Creating adaptable layouts using Trait Collections and Container Views
summary
Shows how Trait Collections plus Auto Layout and container views produce a single codebase that swaps between an iPhone single-column and an iPad master/detail; demonstrates overriding trait collections with overrideTraitCollection to force a compact width for embedded components. Builds a grid→detail demo, a custom zoom animator and presentation controller that becomes full‑screen on compact devices, and uses UIFontMetrics and custom fonts to scale for accessibility. Uses Xcode 9 features, asset catalog size‑class images, and a playground wrapper to validate layouts.
AI-written summary · about
chapters (18)
- 0:00Intro
- 2:54Outline
- 3:25Adaptive Presentations
- 3:41Accessibility
- 4:06Apple Tools
- 5:05Design Layouts
- 6:16TraitCollection API
- 6:51TraitCollection Properties
- 7:45Size Classes
- 8:00Life Cycle
- 8:44Controller Containment
- 9:30Maps Example
- 10:54Adding Constraints
- 17:58Review
- 19:39Animator
- 22:49Presentation Controllers
- 26:35Font Metrics
- 31:12Summary
related talks
41mWhen You Can’t Go All In On SwiftUI, Build a Hybrid UI App Instead!
20mCreating reusable container views
38mWhy is Adaptive Layout a Nightmare?
50mLet's Design UI the Right Way
40mMobiconf 2018: John Sundell, Swift by Sundell
29mBuilding responsive CSS components
37mConstraintLayout deep dive
37mAdopting SwiftUI at scale
