exc_arithmetic error with simulator only, assigning UICollectionView flowlayout exc_arithmetic error with simulator only, assigning UICollectionView flowlayout swift swift

exc_arithmetic error with simulator only, assigning UICollectionView flowlayout


Helped to call

reloadData

before

setCollectionViewLayout


I got the exact same issue on a old code I am working on and it appears that I was calling this code from a wrong method. I moved it in more appropriate place, viewDidLoad or init and it works.