title: Swift UICollectionView with Multiple Persisted Grids
body: <p>I've got an approach question here.</p>
  <p>I'm trying to make something like the instagram profile, where there is a UICollectionView that has a header, and a UISegmentedControl. I don't want the UISegmented to contorl to reload the data of the collection view with every click, I want the different grids to exist all at once, and swiping between them keeps doesn't reload the data every time (if the grid has already been loaded). Here is a video of what I mean:</p>
  <p><a href="https://i.stack.imgur.com/SjPt1.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SjPt1.gif" alt="enter image description here" /></a></p>
  <p>Further, I'm trying to figure out how I can make both of these grids interact with the UICollectionVew headers (supplimentary view of kind header), such that when you scroll down past the headers, the grids scroll as well. Here is a video of what I mean:</p>
  <p><a href="https://i.stack.imgur.com/W3YAf.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/W3YAf.gif" alt="enter image description here" /></a></p>
  <p>I've been struggling with how to achieve all of these behaviors. My current attempt was to have a single cell in the collection view that is a paged horizontal ScrollView where each page was its own collection view. This achieved my constraint of having two separate grids that I can change between without reloading the collectionView's data. But, this doesn't interact with the headers in the manner that I had hoped for, and scrolling past the headers comes to an abrupt stop (gif #2).</p>
  <p>I'm wondering if there is a way to achieve this with one collection view that I am unaware of. Any ideas are much appreciated.</p>