Я добавил кнопки в заголовок раздела списка. К сожалению, в AppleTV верхняя кнопка (недоступна) недоступна. Это ошибка или я делаю что-то не так?
Вот мой код: (скопировать и воспроизвести)
struct ContentView: View {
var lista = ["asldfjas df", "lasj dfkljasd flkajs dfkl", "lksadflas"]
var listb = ["asldsdfa fesaf fjas df", "lasj dfkl asdffd jasd flkajs dfkl", "lksadfasdf asdf las"]
init() {
UITableViewCell.appearance().backgroundColor = .clear
UITableView.appearance().backgroundColor = .clear
}
var body: some View {
VStack {
List {
Section(header:
HStack {
Spacer()
Text("List A").foregroundColor(Color.white)
Spacer()
}) {
ForEach(lista, id: \.self) { name in
Text(name)
}
}
Section(header:
VStack {
HStack {
Button(action: {
print("tap header")
}) {
Text("unreachable")
.foregroundColor(Color.black)
}
Spacer() // if i comment out these 2 lines, the button is reachable again
Text("List B") // if i comment out these 2 lines, the button is reachable again
}
Button(action: {
print("another whatever")
}) {
Text("another whatever")
.foregroundColor(Color.black)
}
Text("whatever")
.foregroundColor(Color.white)
.font(.largeTitle)
}) {
ForEach(listb, id: \.self) { name in
Button(action: {
print("tap in list")
}) {
Text(name)
}
}
}.background(Color.clear)
}
}.edgesIgnoringSafeArea(.all)
}
}