This is the code
struct Lumba:Identifiable {
var id = UUID()
var name:String
var subLumba:[Lumba]?
}
struct ContentView: View {
let array = [
Lumba(name:"aaa", subLumba: [
Lumba(name: "a1", subLumba: nil), Lumba(name: "a3", subLumba: nil), Lumba(name:"a3", subLumba: nil)]),
Lumba(name:"bbb", subLumba: nil)
]
var body: some View {
ZStack {
List(array, children: .subLumba) { scrollItem in
Text(scrollItem.name)
.listRowBackground(Color.clear)
.background(Color.clear)
}
.listRowBackground(Color.clear)
}
.background(Color.red)
.onAppear() {
UITableView.appearance().separatorStyle = .none
UITableView.appearance().backgroundColor = UIColor.clear
UITableViewCell.appearance().backgroundColor = UIColor.clear
}
}
}
This code contains stuff that answers on Stack Overflow say to add, to make the list transparent, plus a lot of redundant code.
The list continues white.
The solutions on StackOverflow work for simple lists but not to expandable.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…