I came across an issue in collection view in our project -

1. Collectionview consist of 4 sections. Each section consist of 1 cell.
2. If we keep height zero for a collection view cell in section 0, cellforrrowatindexpath will not be called for section zero. The problem we are facing is cellforrowatindexapath will not be called for subsequent sections as well. Collection view will not display anything on the screen though other section cells heights are provided.

Updated:

```
 func numberOfSections(in collectionView: UICollectionView) -> Int {
       return 3
    }

    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
    return 1 
    }

 func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
      Switch indexpath.section {
     case 0: return  CGSize(width: UIScreen.main.bounds.width, height: 0)
         case 1:  return CGSize(width: UIScreen.main.bounds.width, height: 200)
         case 2: return CGSize(width: UIScreen.main.bounds.width, height: 300)
      }
 }

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
 Switch indexpath.section {
     case 0: return A()
         case 1: return B()
         case 2: return C()
      }
}

```

If anyone has better understanding of why collection view works in this way please let me know.