Apple expands SwiftUI with new responsive layout primitives for VisionOS and iOS
Design · 4 min read
At WWDC this year Apple announced a new suite of SwiftUI layout primitives designed to bridge the gap between 2D and spatial interfaces. The primitives — AdaptiveStack, SpatialGrid, and FluidType — automatically adjust their layout behavior based on device context (screen vs. headset) and available space, reducing the need for platform-specific conditionals.
AdaptiveStack behaves like an HStack/VStack hybrid that can pivot orientation and density depending on form factor and input method, while SpatialGrid offers a flow-style grid that reflows into layers in VisionOS. FluidType ties into Dynamic Type and introduces new metrics for depth-aware line length and scale.
Apple also updated Xcode's preview engine to simulate spatial layouts and hand gestures, and provided migration guides for existing SwiftUI apps. Developers report the new primitives cut cross-platform layout code significantly, though some edge-cases around complex animations still need manual tuning.