title: Core data not being updated after managedContext.save but no errors thrown
body: <p>I'm trying to update an already saved entry in Core data, objectContext isn't nil neither is the managedObject. The new values get set to the managedObject with said Id. No errors are thrown when calling managedContext.save() but no changes are reflected in the coreData</p>
  
  <p>I have tried using setValue() no avail and I have searched far and wide on google and stack overflow for a similar problem and most of the time it says to say that the managedObject is nil.</p>
  
  <pre class="lang-swift prettyprint-override"><code>    var taskName:String!
      var resultsController: NSFetchedResultsController&lt;Tasks&gt;!
  
      // MARK: - Properties
      // Manage objects and update tasks
      //var resultsController: NSFetchedResultsController&lt;Tasks&gt;!
      var managedContext: NSManagedObjectContext!
      var tasksArray = [NSManagedObject]()
      var fetchRequest = NSFetchRequest&lt;NSFetchRequestResult&gt;(entityName: "Tasks")
  
  
  func settextfields() {
          let res = resultsController.fetchedObjects!
          print(res)
          for r in res {
              if r.name == taskName {
                  txt_name.text = "\(r.name ?? "Task name" )"
                  txt_date.text = "\(r.date ?? "Task date")"
                  segmentedBtn.selectedSegmentIndex = Int(r.priority)
              }
          }
      }
  
      func loadTable() {
          let request: NSFetchRequest&lt;Tasks&gt; = Tasks.fetchRequest()
          // Sort by date
          let sortDescriptor = NSSortDescriptor(key: "date", ascending: true)
          request.sortDescriptors = [sortDescriptor]
          resultsController = NSFetchedResultsController(fetchRequest: request, managedObjectContext: coreData.managedContext, sectionNameKeyPath: nil, cacheName: nil)
  
          // Fetch data
          do {
              try resultsController.performFetch()
              print("Fetch successful")
          } catch  {
              print("Error performing fetch: \(error)")
          }
      }
  
      @IBAction func saveEdit(_ sender: Any) {
                  guard let name = txt_name.text, !name.isEmpty else {
                      return
                  }
  
                  guard let date = txt_date.text, !date.isEmpty else {
                      return
                  }
  
  
          do {
              loadTable()
               let res = resultsController.fetchedObjects!
                  for r in res {
                      i += 1
                      if r.name == taskName {
                          print(r)
                          guard let name = txt_name.text, !name.isEmpty else {
                              return
                          }
                          guard let date = txt_date.text, !date.isEmpty else {
                              return
                          }
                          do {
                              r.name = name
                              r.date = date
                              r.priority = Int16(segmentedBtn.selectedSegmentIndex)
                          }
  
                          do {
                              try managedContext.save()
                              print(managedContext, r)
                              dismiss(animated: true)
                              print("Edit Successful!")
                          } catch  {
                              print("Error saving task: \(error)")
                          }
                      }
              }
  
          }
  </code></pre>