I have a TabView with PageTabViewStyle and when my device is in landscape orientation, there is an odd inset on the leading edge. This is not there on devices without a safeArea and it is not there on any edge in portrait.
struct ContentView: View {
var body: some View {
TabView {
Color.red
.edgesIgnoringSafeArea(.all)
}
.tabViewStyle(PageTabViewStyle())
.edgesIgnoringSafeArea(.all)
}
}
2
Answers
That would be the TabView doing that. That is actually the "prior" view, which would be an empty view for your set up. You can see if you run this code in landscape:
Then swipe to the next view. You will see that slice of the screen has turned red. Swipe again and it turns blue.
The fix: set a
.frame
on theTabView
that is the device size, but all of it in aScrollView
and put an.edgesIgnoringSafeArea(.all)
on that:And yes, the
TabView
can scroll vertically, but it will spring back.If you want to have only the background in fullscreen try it like this: