Problem: My TabView with PageTabViewStyle has content of different heights. I can swipe between different pages, however inside the ScrollView my TabView shrinks to 0 height.
Expected: TabView has height of the largest child view.
I have encountered similar problem before, but just hardcoded approximate frame height of largest view, but it doesn't seem right way to go. Any ideas much appreciated.
struct ContentView: View {
var body: some View {
// ScrollView {
VStack {
TabView {
ForEach(1..<5, id:\.self) { index in
VStack {
DifferentSizeViews(times: index)
Spacer()
}
}
}
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
Text("Some other content")
}
}
// }
}
struct DifferentSizeViews: View {
var times: Int
var body: some View {
VStack {
ForEach(0..<times, id:\.self) { index in
Text("some text \(index)")
}
}
}
}