Came here to say thank you — this issue is still present, and your solution helped!
Instead of going to the next image, my TabView (nested in a VStack that has .ignoresSafeArea(edges: .vertical)) shifted the image up and then refused to switch from there on — unless you manually swipe.
It only seems to happen when the TabView extends beyond the safe area. Otherwise, everything works fine even without the fix.
Here’s the setup:
VStack(alignment: .leading, spacing: 0) {
TabView {
ForEach(viewModel.state.backgroudImages, id: \.self) { imageResource in
Image(imageResource)
.resizable()
.scaledToFill()
}
}
.tabViewStyle(PageTabViewStyle())
.indexViewStyle(PageIndexViewStyle(backgroundDisplayMode: .always))
.background(.red.opacity(0.001)) // This line did the trick
// Other content
}
.ignoresSafeArea(edges: .vertical)
.dynamicTypeSize(...DynamicTypeSize.large)
.toolbar {
toolbarItems
}
.navigationTitle("Get AppName Pro")
.navigationBarTitleDisplayMode(.inline)
.background(.red.opacity(0.001)) — just that — and the switching works perfectly:
Without it, tapping on the PageIndex causes this broken behavior:
Topic:
UI Frameworks
SubTopic:
SwiftUI