For a Carousel custom component we are using a TabView with the following modifier:
.tabViewStyle(.page(indexDisplayMode: .never))
Everything is working quite well, except that during rotation handling, a strange bottom inset appear on the bottom:
Looking more in deep with the Debug view, we found that top origin is wrongly translated by about 10px.
Attached a snip of code that reproduce the problem, running Xcode15.2 and iOS17.2:
import SwiftUI
@main
struct TabViewDemoIssueApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.ignoresSafeArea(.all, edges: .all)
}
}
}
struct ContentView: View {
var body: some View {
TabView {
Rectangle().foregroundColor(.red)
.ignoresSafeArea(.all, edges: .all)
Rectangle().foregroundColor(.yellow)
.ignoresSafeArea(.all, edges: .all)
}
.ignoresSafeArea(.all, edges: .all)
.background(.green)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.tabViewStyle(.page(indexDisplayMode: .never))
}
}
#Preview {
ContentView()
}
UPDATE: We opened a bug to Apple: FB13526097


I've give it a look and came up with a solution. It's a workaround really, it was the best I could come up with in a short amount of time. It's a mistery to me too why your view behaves like that. So, what I've done is I'm detecting the device rotations and apply a small scale bump if it is not in portrait mode. Here's the code:
And you edit your view like this:
Let me know if that could work for you, I know it's a workaround. Using the overlay, any view inside won't be affected be the small resizing of the undelying view. Here's the result: