I have a UICollectionView and I want to change the layoutAttributes of my collectionView.
I am calling this function:
override func apply(_ layoutAttributes: UICollectionViewLayoutAttributes) {
print("Layout has been changed lit fool.")
let targetSize = CGSize(width: 10, height: 40)
layoutAttributes.frame.size = contentView.systemLayoutSizeFitting(targetSize, withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel)
}
For some reason my layoutAttributes are not being effected by this code. No matter what variable I change my targetSize to, the collectionView size stays the same. The print statement is running, so I know that this function is getting called correctly, its just the layoutAttributes don't change.
How do I get my layoutAttributes to change from this function?