TabView inside NavigationStack is abnormal when using Xcode 26. The y deviation is about 14.
But it is right when using Xcode 16.4.
It is also right without NavigationStack.
import SwiftUI
struct ContentView: View {
private enum Tab: Hashable, CaseIterable {
case a
case b
}
@State private var currentTab: Tab = .a
@State private var path: NavigationPath = NavigationPath()
var body: some View {
NavigationStack(path: $path) {
TabView(selection: $currentTab) {
ForEach(Tab.allCases, id: \.self) { tab in
switch tab {
case .a:
Color.blue
// .offset(y: -14)
case .b:
Color.yellow
}
}
}
.tabViewStyle(.page(indexDisplayMode: .never))
.ignoresSafeArea(.all)
}
}
}