This is the first cell, notice how the second cell is showing on right, what i want to achieve is, to keep my cell in centered while still showing parts left and right side cell when Paging is enabled.
// MARK: - CollectionView layout configuration
extension HomeVC: UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: collectionView.bounds.width - (indexPath.row == 0 || indexPath.row == list.count - 1 ? 50 : 40), height: collectionView.bounds.height)
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 10
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return 10
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
if section == 0 {
return UIEdgeInsets(top: 0, left: 30, bottom: 0, right: 30)
} else {
return UIEdgeInsets.zero
}
}
}