iPhone Duo SwiftUI examples
Explore SwiftUI APIs, components, and modifiers on iPhone Duo. Compare portrait and landscape layouts in closed, partially open, and fully open states, with Swift code and Apple documentation.
16elements
ArrangementView
Overlay Arrangement ZIndex
The z-index for a view within an overlay arrangement view.
Explore Overlay Arrangement ZIndex on iPhone Duo in portrait and landscape across closed, partially open, and fully open states, with SwiftUI code and Apple API documentation.
SwiftUI code
var body: some View {
ArrangementView {
// VStack required, otherwise zIndex is always 0
VStack {
SecondaryView()
}
} secondary: {
Color.orange
}
.arrangementViewStyle(.overlay)
}
struct SecondaryView: View {
@Environment(\.overlayArrangementZIndex) var zIndex
var body: some View {
Color.blue
.frame(width: 210, height: 210)
.opacity(zIndex == 0 ? 1.0 : 0)
}
}Compatibility
iOS 27.1+ iPadOS 27.1+
Tags
Found an issue or have a suggestion?
All variants
Every available iPhone Duo screenshot for Overlay Arrangement ZIndex.