Adding an ondelete for a CoreData list in SWIFTUI

Hi

What do I define in the OnDelete to set what to delete.


code:

Environment(\.managedObjectContext) var moc
   
  @FetchRequest(entity: Faces.entity(), sortDescriptors: [
    NSSortDescriptor(keyPath: \Faces.facename, ascending: true),
    NSSortDescriptor(keyPath: \Faces.relationship, ascending: true),
    NSSortDescriptor(keyPath: \Faces.birthday, ascending: true),
    ]
  ) var DBFaces: FetchedResults<Faces>

var body: some View {
    NavigationView {
      List {
        ForEach(DBFaces, id: \.self) { face in
          Text("\(face.facename ?? “-“)”)
              .font(.title)
              .foregroundColor(.secondary)
              } 
         } // foreach
         .ondelete ( ???? )
        .padding()
      }//List
  } // NavView
} // View
Adding an ondelete for a CoreData list in SWIFTUI
 
 
Q