You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Only reconfigure visible supplementary views when applying snapshots
Similar to e2a1478bb3f4ac4dae26f422dc9c62185b48018c.
optimize the headers, footers, and other supplementary views that we reconfigure.
previously, we already had a lot of escape hatches where we could short circuit this loop through all the sections and all their views.
this adds another early return by only checking the sections that are visible. if a section is not visible, we can skip it.
when a previously not visible section scrolls on screen, it will go through the whole dequeue + configure flow for all its cells and views. so this should be safe to do.
**visibility notes**
determining section visibility is a bit of a "hack" -- there's no direct API for this, so instead we need to check for supplementary views that are visible via `indexPathsForVisibleSupplementaryElements`. from there we can derive the visible section indexes, and then resolve their identifiers.
all of that is necessary because we cannot query supplementary views directly like we can for items. `DiffableDataSource` provides `self.itemIdentifier(for: indexPath)` but there is no equivalent for supplementary views.
it's all a bit roundabout, but it works.
0 commit comments