title: Core Data - reflect parent context changed to child context without saving child
body: <p>From here I tried to use a childContext for adding a new entity which could be thrown away if the user doesnt want to save it: <a href="https://stackoverflow.com/questions/60977658/how-do-i-implement-a-child-context-coredata-in-swiftui-environment">How do I implement a child context (CoreData) in SwiftUI environment?</a></p>
  <p>In the View for Adding there is the temporary Person Object and a List to connect a category to the Person. I wonder if it is possible to delete a category from the parent store and reflect this to the child context? <strong>If I save the child context the new added temporary Person would be saved which is not correct</strong>. But if I only save the parent the Category List is not updated because I think this is the reflection of the childContext, right?</p>
  <pre><code>struct ContentView: View{
      @Environment(\.managedObjectContext) var moc
      @FetchRequest() var persons: FetchedResults&lt;Person&gt;
  
      @State private var personCreation: CreateOperation&lt;Ausgabe&gt;?
  
      var body: some View{
          VStack{
              Button(&quot;add&quot;){
                  personCreation = CreateOperation(withParentContext: moc)
              }
              List(persons){p in
                  Text(p.name)
              }
              .sheet(item: $personCreation){personHandler in
                  AddingView(
                      personTemp: personHandler.object
                  )
                  .environment(\.managedObjectContext, creationHandler.childContext)
              }
          }
      }
  }
  
  struct AddingView: View{
      @Environment(\.managedObjectContext) var childMoc
      @ObservedObject pers: Person
      @FetchRequest var persCats: FetchedResults&lt;Pers_Category&gt;
  
      var body: some View{
          VStack{
              ForEach(persCats){cat in
                  Text(cat.name)
                      .onTapGesture{
                          if let parentCat = context.parent?.object(with: cat.objectID){
                              childMoc.parent?.delete(parentCat)                 //&lt;------ Here
                              try? childMoc.parent?.save()
                          }
                      }
              }
              TextField(&quot;name&quot;, text: $pers.name)
          }
      }
  }
  
  
  
  
  struct CreateOperation&lt;Object: NSManagedObject&gt;: Identifiable {
      let id = UUID()
      let childContext: NSManagedObjectContext
      let object: Object
      
      init(withParentContext parentContext: NSManagedObjectContext) {
          childContext = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
          childContext.parent = parentContext
          object = Object(context: childContext)
      }
  }
  </code></pre>