ForEach onDelete is not working with LazyVStack, but same code working fine with List. Any Idea ? Even swipe is not working here.
NavigationView {
ScrollView {
LazyVStack(spacing: 5) {
Section(footer: ListFooterView()) {
ForEach(items.wrappedValue) { item in
ZStack {
if item.isNewItem {
NavigationLink(destination: EditItemView(item: item)) {
ItemRowView(item: item)
}
}else {
NavigationLink(destination: ItemDetailView(item: item)) {
ItemRowView(item: item)
}
}
}
}.onDelete { offsets in
let allItems = items
for offset in offsets {
let item = allItems.wrappedValue[offset]
dataController.delete(item)
}
dataController.save()
}
}
}
}