Context
I am having a SwiftUI
ScrollView
and would like to use Paged TabViews
inside to display data. However, this concludes in strange behaviour of the View
collapsing to zero height.
Code
struct SomeView: View {
var body: some View {
NavigationView {
ScrollView {
TabView {
Text("View A")
Text("View B")
Text("View C")
}
.tabViewStyle(.page)
}
}
}
}
Questions
- How can I achieve my goal of using a
Paged TabView
inside a largerScrollView
without it collapsing to zero height? - I read in the documentation, that
.tabViewStyle(.page)
is not available onmacOS
. Is there any workaround to still usePaged TabViews
onmacOS
?