title: Why can't I see an image in Swift?
body: <p>I am going to make an image slide. So I used CollectionView.</p>
  
  <p>But I can't see the image. What's the problem?</p>
  
  <p><strong>ViewController.swift</strong></p>
  
  <pre class="lang-swift prettyprint-override"><code>import UIKit
  
  class ViewController: UIViewController {
  
      @IBOutlet weak var collectionView: UICollectionView!
  
      var imageArray = [UIImage(named: "swipe1"),
                        UIImage(named: "swipe2"),
                        UIImage(named: "swipe3"),
                        UIImage(named: "swipe4"),
                        UIImage(named: "swipe5")]
  
  
      override func viewDidLoad() {
          super.viewDidLoad()
      }
  }
  
  extension ViewController: UICollectionViewDelegate, UICollectionViewDataSource {
      func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
          return imageArray.count
      }
  
      func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
          let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as? DataCollectionViewCell
          cell?.img.image = imageArray[indexPath.row]
          return cell!
      }
  }
  
  extension ViewController: UICollectionViewDelegateFlowLayout {
      func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -&gt; CGSize {
          let size = collectionView.frame.size
          return CGSize(width: size.width, height: size.height)
      }
  
      func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -&gt; UIEdgeInsets {
          return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
      }
  
      func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -&gt; CGFloat {
          return 0
      }
  
      func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -&gt; CGFloat {
          return 0
      }
  }
  </code></pre>
  
  <p><strong>DataCollectionViewCell.swift</strong></p>
  
  <pre class="lang-swift prettyprint-override"><code>import UIKit
  
  class DataCollectionViewCell: UICollectionViewCell {
  
      @IBOutlet weak var img: UIImageView!
  
  }
  </code></pre>
  
  <p><strong>StoryBoard</strong></p>
  
  <p><a href="https://i.stack.imgur.com/uCV0J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uCV0J.png" alt="enter image description here"></a></p>
  
  <p><strong>CollectionView</strong></p>
  
  <p><a href="https://i.stack.imgur.com/5drkI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5drkI.png" alt="enter image description here"></a></p>
  
  <p><strong>cell</strong></p>
  
  <p><a href="https://i.stack.imgur.com/oqBD1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oqBD1.png" alt="enter image description here"></a></p>
  
  <p><strong>Content View</strong></p>
  
  <p><a href="https://i.stack.imgur.com/ckDiP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ckDiP.png" alt="enter image description here"></a></p>
  
  <p><strong>img</strong></p>
  
  <p><a href="https://i.stack.imgur.com/Azrhs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Azrhs.png" alt="enter image description here"></a></p>
  
  <p><strong>Button</strong></p>
  
  <p><a href="https://i.stack.imgur.com/wfDPw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wfDPw.png" alt="enter image description here"></a></p>
  
  <p><strong>view</strong></p>
  
  <p><a href="https://i.stack.imgur.com/cap6A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cap6A.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/y3baT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y3baT.png" alt="enter image description here"></a></p>
  
  <blockquote>
    <p>the image asset is correct. You have already completed the test.</p>
  </blockquote>
  
  <p>How can I this problem??</p>
  
  <p>Has anyone solved the same problem as me? Tell me how you solved it.</p>