title: Use 2 different UICollectionView in single Storybord in swift
body: <p>I am new to the swift and iOS application I am working on a UI part where I need to display some sort of UI like Zomato where there are two UICollectionView from which one is at the top showing deals and the other one is aligned to the bottom showing businesses. The the first one is horizontal scroll and the second one is vertical scroll. </p>
  
  <p>I want to achieve this using UICollectionView and a Storyboard. I have designed perfectly the one that is on top now I want to design the second one, but I don't know how to use the second UICollectionView </p>
  
  <p>Below is my code:</p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView,
                      numberOfItemsInSection section: Int) -&gt; Int {
      return dealImage.count
  }
  
  func collectionView(_ collectionView: UICollectionView,
                      cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
       let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "BusinessCollectionViewCell",
                                                     for: indexPath) as? BusinessCollectionViewCell
      cell?.businessImage.sd_setImage(with: URL(string: dealImage[indexPath.row]),
                                      placeholderImage: UIImage(named: ""))
      return cell!
  }
  </code></pre>
  
  <p>The two UICollectionViews are declared like this:</p>
  
  <pre><code>@IBOutlet var businessCollectionView: UICollectionView!
  @IBOutlet var dealCollectionView: UICollectionView!
  </code></pre>
  
  <p>How to add dealCollectionView?</p>
  
  <p>As per my understanding, I have written the code, please let me know if it is good or not </p>
  
  <pre><code>func dealCollectionView(_ dealCollectionView: UICollectionView,
                          numberOfItemsInSection section: Int) -&gt; Int {
      return dealImage.count
  }
  
  func dealCollectionView(_ dealCollectionView: UICollectionView,
                          cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
      let cell = dealCollectionView.dequeueReusableCell(withReuseIdentifier: "DealCollectionViewCell",
                                                        for: indexPath) as? DealCollectionViewCell
      cell?.dealImageView.layer.cornerRadius = 20
      cell?.dealImageView.clipsToBounds = true
      cell?.dealImageView.sd_setImage(with: URL(string: dealImage[indexPath.row]),
                                      placeholderImage: UIImage(named: ""))
      return cell!
  }
  
  func collectionView(_ businessCollectionView: UICollectionView,
                      numberOfItemsInSection section: Int) -&gt; Int {
      return dealImage.count
  }
  
  func collectionView(_ businessCollectionView: UICollectionView,
                      cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
       let cell = businessCollectionView.dequeueReusableCell(withReuseIdentifier: "BusinessCollectionViewCell",
                                         for: indexPath) as? BusinessCollectionViewCell
      cell?.businessImage.sd_setImage(with: URL(string: dealImage[indexPath.row]),
                                      placeholderImage: UIImage(named: ""))
      return cell!
  }
  </code></pre>