title: after delete of item in SwiftUI List (backed by Core Data) getting a "Thread 1: EXC_BAD_INSTRUCTION" error? (code attached)
body: <p>After completing a delete of a row in a SwiftUI List I am getting a "Thread 1: EXC_BAD_INSTRUCTION" error.  It seems the Core Data delete works as after I restart that data has been removed.  So maybe something to do with SwiftUI trying to update it's view after the Core Data delete is performed????</p>
  
  <p>Code:</p>
  
  <pre><code>import SwiftUI
  import CoreData
  
  struct ContentView: View {
      @Environment(\.managedObjectContext) var context
      @FetchRequest(entity: GCItem.entity(), sortDescriptors: []) var gcItems: FetchedResults&lt;GCItem&gt;
  
      private func addItem(title:String) {
          let newItem = GCItem(context: context)
          newItem.id = UUID()
          newItem.title = title
          do {
              try context.save()
          } catch let e as NSError {
              fatalError("Unresolved error \(e), \(e.userInfo)")
          }
      }
  
      private func deleteItem(at offsets:IndexSet) {
          self.context.perform {
              // Delete Item
              for index in offsets {
                  let item = self.gcItems[index]
                  self.context.delete(item)
              }
  
              // Persist
              do {
                  try self.context.save()
              } catch let e as NSError {
                  // TODO: How to undelete list???
                  print("ERROR : Can not save GCItem items: \(e.description)")
              }
          }
      }
  
      var body: some View {
          NavigationView {
              VStack {
                  List() {
                      ForEach(gcItems) { gcItem in
                          HStack {
                              Text("test")
                          }
                      }
                      .onDelete(perform: self.deleteItem)
                  }
                  Button(action: { self.addItem(title: "Testing 123") }) {
                      Text("ADD ITEM")
                  }
              }
          }
      }
  }
  #if DEBUG
  struct ContentView_Previews: PreviewProvider {
      static var previews: some View {
          let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
          return ContentView().environment(\.managedObjectContext, context)
      }
  }
  #endif
  </code></pre>
  
  <p>Screen Shot </p>
  
  <p><a href="https://i.stack.imgur.com/e73Oy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/e73Oy.png" alt="enter image description here"></a></p>