I am wanting to add a TabView with a List, inside another List. The issue is that adding a list with a TabView that has a list inside makes it so that the view is small. Can't figure out if this scenario is possible.
The reason it needs two List is because i am going to add the Tab Selector as a sticky header, which comes built in by using Section
inside the List.
@State private var selectedTab = 1
var body: some View {
List {
// TAB SELECTOR
HStack {
Spacer()
Button(action: {selectedTab = 1}) {
Text("First Tab")
}
Spacer()
Button(action: {selectedTab = 2}) {
Text("Second Tab")
}
Spacer()
Button(action: {selectedTab = 3}) {
Text("Thrid Tab")
}
Spacer()
}
// TABS
TabView(selection: $selectedTab) {
Text("First Tab View")
.tag(1)
VStack {
List {
ForEach(0 ..< 20) { index in
Text("This is index \(index)")
}
}
}
.tag(2)
Text("Third Tab View")
.tag(3)
}
}
}