I have no clue on why this is not working. I've always done it the same way, the only difference is the sorted method.
ForEach(userData.fruits_and_vegetables.sorted { $0.item < $1.item}) { grocery in
DetailCardView(item: grocery.item, itemCount: grocery.count)
}.onDelete { (offset) in
self.userData.fruits_and_vegetables.remove(atOffsets: offset)
}
Help! Thanks