I'm working on a project in iOS, Swift. How Can we assign one collectionView with two different flow layout? Here I need my UICollectionViewCell to look like a stack-card, for that, I'm using CardsCollectionViewLayout(external pod file).
myCollectionView.collectionViewLayout = CardsCollectionViewLayout()
And it is working fine. But the issue is I cant adjust the UICollectionViewCell width with device width. For that, I need to use UICollectionViewDelegateFlowLayout.
func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAt indexPath: IndexPath) -> CGSize {
let nCol = 1
let flowLayout = collectionViewLayout as! UICollectionViewFlowLayout
let totalSpace = flowLayout.sectionInset.left
+ flowLayout.sectionInset.right
+ (flowLayout.minimumInteritemSpacing * CGFloat(nbCol - 1))
let size = Int((collectionView.bounds.width - totalSpace) / CGFloat(nbCol))
return CGSize(width: size, height: 284)
}
But When I use CardsCollectionViewLayout as my collectionView layout, I did not get the call back in the above method.
OR
Is there any way to add stack-card effect with my UICollectionViewCell.
Please help me.