- How can I achieve my goal of using a Paged TabView inside a larger ScrollView without it collapsing to zero height?
To fix height issue with TabView inside ScrollView you need to add .aspectRatio(contentMode: .fit) modifier to the TabView.
struct SomeView: View {
var body: some View {
NavigationView {
ScrollView {
TabView {
Text("View A")
Text("View B")
Text("View C")
}
.tabViewStyle(.page)
.aspectRatio(contentMode: .fit) // <- Will fix the height issue
}
}
}
}