iOS Platform & SwiftUI (50 Qs)•Part 3: Instruments Profiling, App Architecture & Production Hardening (25 - 35)
How do LazyVStack and LazyHStack optimize memory in SwiftUI lists?
senior LevelPerformanceMemory ManagementSystem Design
In Simple Words:
Standard VStack creates and calculates body layouts for all subviews immediately upon instantiation. LazyVStack creates subviews only when they scroll into the visible viewport, preventing memory spikes.