This tutorial is worth GOLD. I finally understand much better how to work with UICollectionViewLayout sub class. Thanks a lot!! Also read the Apple documentation about this. Very helpful.
It is interesting. I didnโt know it is so straightforward. Basically just calculate the frames of each item with a loop. I thought it is way more complex than this. When I was working with SpriteKit before this, where of course you donโt have collection views I had to manually calculate the frames of each item with a loop (letโs say 10 boxes of the same width and height) with i * (size + padding). But with dynamic heights I just have to increase the Y offset after every loop.
First of all great tutorial. Thanks for the great example. I used it to build a custom layout for my collection view. In my layout I have a list of tags that are filterable by a search bar. I was having some seemingly random crashes and fixed it by calling super.prepare() in the overridden prepare() function. It fixed my crashes. Not sure if anyone is running into anything like. Should we be calling super.prepare()?
I am facing exactly the same issue. Crash occuring at line
guard cache.isEmpty == true, let collectionView = collectionView else {
return
}
I am getting data from web service and then reloading the collection view .
Can you please explain in more detail how to implement purge cache policy. Where to purge the cache. and when to invalidate the collection view layout ?
If you add a translucent Navigation bar, the collection view will be underneath (and the same with searchbar). How can I solve this Problem without hard coded Offsets?