title: How to add a background image to a UICollectionViewCell in Swift?
body: <p>I had assumed that it would be easy to add a background image to a <code>UICollectionViewCell</code>, but I am having trouble figuring it out. I have a border image like this that I want to add to every cell in my <code>UICollectionView</code>.</p>
  
  <p><code>border.png</code></p>
  
  <p><a href="https://i.stack.imgur.com/veX0D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/veX0D.png" alt="enter image description here"></a></p>
  
  <p>I couldn't see an option to add it in the Interface Builder and I'm not sure which method to use on <code>UICollectionViewCell</code> programmatically.</p>
  
  <p>I have seen these similar questions:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/27187166/uicollectionview-cell-with-image-change-background-with-click">UICollectionView Cell with Image, change Background with click</a> (image is already added)</li>
  <li><a href="https://stackoverflow.com/questions/21161823/how-to-add-a-background-image-to-uicollectionview-that-will-scroll-and-zoom-will">How to add a background image to UICollectionView that will scroll and zoom will cells</a> (<code>UICollectionView</code>, not <code>UICollectionViewCell</code>)</li>
  </ul>