The Problem

What should be recalculated?

Invalidation Contexts

These are the path to stutter free scrolling. They’re basically a description of what is now considered invalid or “dirty”, so that the collection view can know what parts of the layout it needs to ask for again (rather than the whole thing again). But also they are a description of what we need to recalculate, so when the collection view asks for attributes again we can give it correctly updated ones.

Subclassing

UICollectionViewLayoutInvalidationContext

class TableViewLayoutInvalidationContext: UICollectionViewLayoutInvalidationContext {
    var heightAdjustedIndexPath: IndexPath?
}

More Complex Layouts

End of part 3

Max Clarke

Tech Lead,Brisbane

Max Clarke

Tech Lead,Brisbane