title: Can't Reload Collection View Swift 4
body: <p>In a detail view controller, the user can add a character to the favorites list. Clicking the favorite button adds the image url to CoreData. Then in the collection view controller, I run the code below:</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
      let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
      let request = NSFetchRequest&lt;NSFetchRequestResult&gt;(entityName: "Favorite")
  
      request.returnsObjectsAsFaults = false
  
      do {
          let results = try context.fetch(request)
          if results.count &gt; 0
          {
              for result in results as! [NSManagedObject]
              {
                  if let favFig = result.value(forKey: "favFig") as? String
                  {
                      favFigArray.append(favFig)
                  }
                  if let favFigID = result.value(forKey: "favoriteID") as? String
                  {
                      favFigIDArray.append(favFigID)
                  }
              }
  
          }
      } catch {
          print("Error Fetching")
      }
  }
  </code></pre>
  
  <p>The favFigArray then contains a list of the image urls. To set the image to my collection view cell I use this code:</p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
      let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ownedCell", for: indexPath) as! OwnedCollectionViewCell
      cell.ownedFigImage.sd_setImage(with: URL(string: favFigArray[indexPath.row]))
  
      return cell
  }
  </code></pre>
  
  <p>The problem I have is that when a user wants to go back to the detail view controller and add more characters to the favorites list, the collection view will not update. I tried using self.ownedCollectionView.reloadData() in the viewWillAppear and that does not work. CoreData is updating properly, but favFigArray is not updating. </p>
  
  <p>Can anyone help me get the reload to work? Thank you!</p>