After updating from swift 4 to swift 5, my UICollectionView is disappearing while scrolling (ONLY horizontal view) because in the gif file there's another UICollectionView but it's vertical, I didn't face this problem in swift 4, I searched stack overflow and I saw a lot of answer but it didn't helped me ,
this is a gif. file show the process
this is my heightForRowAt function
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
switch indexPath.section {
case 0:
return UITableView.automaticDimension
case 1:
return 200
case 2:
return UITableView.automaticDimension
case 3:
if (self.topAlbumsArray.isEmpty){
return 300.0
}else{
return 120.0
}
default:
return 280
}
}
this is the collectionView function
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: 150, height: 200)
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return 8
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 8
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
return UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 0)
}