title: UICollectionView Reload Data Swift 4
body: <p>My collectionView displays images of characters that have been added as a favorite. This is persisted in Core Data. </p>
  
  <p>On a detail view controller, the user clicks the favorite button which adds the character to favorites. When it is clicked again, the figure is removed. </p>
  
  <p>The problem is the images in the collection view are not updated without closing the app and re-running. I tried using:</p>
  
  <pre><code>override func viewWillAppear(_ animated: Bool) {
      super.viewWillAppear(animated)
      self.favoriteCollectionView.reloadData()
  }
  </code></pre>
  
  <p>But this was unsuccessful. How can I get the collection view to update?</p>
  
  <p>UPDATE: Here is all that is in the cellForItemAt function.</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>