When using ArrangementView with the overlay style, the Duo simulator does not appear to return a distinct z-index environment value, though it correctly displays z-index 0 and 1 on other iPhone simulators.
I would like to use this value to determine whether the overlay is active. Currently, this does not seem possible.
Is this behavior intended, or is it a bug? If intended, what is the recommended approach to determine if the Duo is displaying the arranged view over another arranged view?
import SwiftUI
struct ContentView: View {
var body: some View {
ArrangementView {
Controls()
} secondary: {
Player()
}
.arrangementViewStyle(.overlay)
}
}
struct Controls: View {
@Environment(\.overlayArrangementZIndex) var zIndex
var body: some View {
Text("Controls Z:\(zIndex)")
.frame(maxWidth: .infinity, alignment: .leading)
}
}
struct Player: View {
@Environment(\.overlayArrangementZIndex) var zIndex
var body: some View {
Text("Player Z:\(zIndex)")
.frame(maxWidth: .infinity, alignment: .trailing)
}
}
#Preview {
ContentView()
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
2
0
60