I have a list and a an image I want to use with .backgroundExtensionEffect() what is the correct way, put it in the list or use a stack?
Asked on 2025-08-20
1 search
To use the .backgroundExtensionEffect()
correctly, you should consider the layout and hierarchy of your views. Based on the context provided, it is recommended to use a stack rather than placing the image directly in the list. This is because the background extension effect is designed to extend the appearance of an image or content view beyond the safe area, creating a seamless visual effect.
Here are some key points to consider:
-
Hierarchy: The image view should be assigned to the content view property of the background extension view. This extension view should be added to your view hierarchy, and any additional details or elements should be added as siblings, not as subviews of the extension view. This ensures that the effect is applied correctly without unwanted visual distortion.
-
Layout: Using a stack (such as an
HStack
orVStack
in SwiftUI) allows you to organize your views in a way that maintains the intended layout while applying the background extension effect. This approach provides flexibility in positioning and layering your views. -
Purpose: The background extension effect is particularly useful for hero images, tinted backgrounds, or any surface meant to feel expansive. Ensure that text and controls are layered above the effect to maintain clarity and avoid distortion.
For more detailed guidance, you can refer to the session Build a UIKit app with the new design (05:09) where the use of background extension effects is discussed.

Build a UIKit app with the new design
Update your UIKit app to take full advantage of the new design system. We’ll dive into key changes to tab views, split views, bars, presentations, search, and controls, and show you how to use Liquid Glass in your custom UI. To get the most out of this video, we recommend first watching “Get to know the new design system” for general design guidance.

Platforms State of the Union
Discover the newest advancements on Apple platforms.

SwiftUI essentials
Join us on a tour of SwiftUI, Apple’s declarative user interface framework. Learn essential concepts for building apps in SwiftUI, like views, state variables, and layout. Discover the breadth of APIs for building fully featured experiences and crafting unique custom components. Whether you’re brand new to SwiftUI or an experienced developer, you’ll learn how to take advantage of what SwiftUI has to offer when building great apps.