I tried to make an horizontal list, but when I add on delete property it doesn't work.
var body: some View{
NavigationView {
List {
ScrollView(.horizontal, showsIndicators: false) {
HStack {
Section(
header: Text("Fruits")) {
ForEach(fruits, id: \.self) { fruit in
Text(fruit.capitalized)
}
.onDelete(perform: delete)
}
}
}
}
.navigationTitle("Ejemplo")
.navigationBarItems(leading: EditButton())
}
}
func delete(indexSet: IndexSet){
fruits.remove(atOffsets: indexSet)
}
