'SwiftUI Tabview inside TabView and List items highlight behaviour strange?
I am new in Swift, please help me a hand
The first question is Can use TabView inside a TabView?
If it can be, I got an issue related to List, items inside List is highlighted when I tap into another place
// This tab will have many pages and can swap left/right to change tabs
struct Tab1: View {
var body: some View {
TabView(selection: $otherSelected) {
SubOfTab1()
.tag("tag1")
... other tabs
}
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
}
}
// This tabview will display tab item as bottom
struct ContentView: View {
var body: some View {
TabView(selection: $selected) {
var body: some View {
Tab1()
.tag("tagParent1")
... other tabs
}
}
}
}
struct SubOfTab1: View {
VStack {
Text("Try to tab this text") ------> Try to tab this and all list items below is hightlighted??? why???
.frame(height: 100)
List() {
Text("XX")
Text("XX")
Text("XX")
Text("XX")
...
}
}
}
First run
Tapped to the text above, all items in List are highlighted??

Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

