I have created a project with CoreData having One to Many Relationship (1 Category to many Items). I am having problems updating the Item's 'done' property in Item's View it's updating only when i go back to Category View and then navigate back to Item View
I think i am doing something wrong in the .onTapGesture
Thanks in Advance
Code Block var body: some View { List { ForEach(category!.CitemsArray) { item in HStack { Text("\(item.title!)") .onTapGesture { item.done.toggle() do { try moc.save() } catch { print("error saving done value:\(error)") } } Spacer() if item.done == true { Image(systemName: "checkmark.circle.fill") } else { Image(systemName: "circlebadge") } } } .onDelete(perform: deleteItems) } .sheet(isPresented: $isPresented, content: { ItemEditView(category: category, item: ItemModel()) }) .navigationBarItems(trailing: Button(action: { isPresented.toggle() }, label: { Image(systemName: "plus") })) .navigationBarTitle(category!.name!) }
I think i am doing something wrong in the .onTapGesture
Thanks in Advance