When there is a large number of supplementary views, scrolling is extremely slow.
To reproduce:
- Download Apple's demo of "Implementing Modern Collection Views" from here
- Open project in Xcode and show PinnedSectionHeaderFooterViewController.swift
- Go to line 106 and replace it with
let sections = Array(0..<3000)
- Run project, navigate to "Pinned Section Headers" page, and try scrolling.
Scrolling is barely possible and extremely slow!
While profiling with Time instrument, issue seems to rely in invalidating supplementary views. Screenshot attached below.
How can I fix this? (I have many section headers in my view)