title: How do we reload a collection view on its did select item delegate?
body: <p>I cant reload my collection view from its did Select Item. When I reload the collection view, the delegates <code>numberOfItemsInSection</code> and <code>numberOfSections</code> gets called. However, the <code>cellForItemAt</code> doesn't gets called. Why is this? .Is it inappropriate to reload a collection view from its own <code>didSelectItemAt</code></p>
  
  <p>My code is as below</p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
  
      indexSelectedCell = indexPath.row
  
      collectionView.performBatchUpdates({
  
          DispatchQueue.main.async(execute: {
              self.collAvailableLanguages.reloadData()
          })
  
      }, completion: nil)
  }
  </code></pre>
  
  <p>My requirement is that I want to highlight a label in selected cell and unhighlight the previous cell. I did(try) it by keeping track of current selected cell index. My code is</p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
  
      if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "LanguageCell", for: indexPath) as? BaashaLanguageCell {
          cell.lblLanStr.text = arrAvailbleLanDemo[indexPath.row]
  
          if indexPath.row != 0 || indexPath.row != arrAvailbleLanDemo.count - 1 {
              cell.layer.borderWidth = 0.5
          }
  
          if indexSelectedCell == indexPath.row {
              print("OK")
              cell.layer.borderColor = UIColor.clear.cgColor
  
              switch isHostLanVC {
              case true:
                  cell.lblLanStr.textColor = UIColor(rgb: 0x599441)
              default:
                  cell.lblLanStr.textColor = UIColor(rgb: 0x5F90CB)
  
              }
          } else {
              cell.layer.borderColor = UIColor.lightGray.cgColor
          }
  
          return cell
      } else {
          return BaashaLanguageCell()
      }
  }
  </code></pre>