func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell: UICollectionViewCell = nill let row = (indexPath as NSIndexPath).row if collectionView.tag == 1 { cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ImageCollectionViewCell", for: indexPath) as! ImageCollectionViewCell if recentPostsArray!.count != 0 { cell.postUuid = self.recentPostsArray![row].postUuid cell.imageView.kf.setImage(with: URL(string: "\(self.recentPostsArray![row].postImageUuid!)")) } } else if collectionView.tag == 2 { cell = collectionView.dequeueReusableCell(withReuseIdentifier: "StylesSmallCollectionViewCell", for: indexPath) as! StylesSmallCollectionViewCell cell.styleImage.image = StylesAndCategoriesHelper.getStyle(style: stylesArray[row]).image cell.styleTitle.text = StylesAndCategoriesHelper.getStyle(style: stylesArray[row]).title } else if collectionView.tag == 3 { cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CategoriesSmallCollectionViewCell", for: indexPath) as! CategoriesSmallCollectionViewCell cell.categoryImage.image = StylesAndCategoriesHelper.getCategory(category: categoriesArray[row]).image cell.categoryTitle.text = StylesAndCategoriesHelper.getCategory(category: categoriesArray[row]).title } else { cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ImageCollectionViewCell", for: indexPath) as! ImageCollectionViewCell let row = (indexPath as NSIndexPath).row if followingPostsArray!.count != 0 { cell.postUuid = self.followingPostsArray![row].postUuid cell.imageView.kf.setImage(with: URL(string: "\(self.followingPostsArray![row].postImageUuid!)")) } } return cell }