title: How to retain UISearchBar FirstResponder status on UICollectionView reload?
body: <p>A custom <code>UIViewController</code> contains a <code>UICollectionView</code>. A <code>UISearchBar</code> should be placed at the very top of the collectionView and scroll with its content. If the user enters a search text into the content fo the collectionView should be updated while the searchBar retains its FirstResponder status.</p>
  <p><strong>Something pretty easy which seems to be astonishingly to realize.</strong></p>
  <p>I found several other topics dealing with kind of problem but they are all several years old and none of the proposed solution worked. <strong>I wonder what is the best solution in 2020 using Xcode 11 and iOS 13 to solve this problem.</strong></p>
  <p><strong>What DID NOT work:</strong></p>
  <ul>
  <li>I have added the <code>UISearchBar</code> to the header of the first section. When reloading the complete contentView or its sections the searchBar looses firstResponder and the keyboard is dismissed.</li>
  <li>I have added the <code>UISearchBar</code> as subview to the collectionView and used the collectionViews contentOffset to place the content below the search bar. Although the searchBar is part of the collectionVies dynamic view hierarch, the Problem is the same es before: When reloading the complete contentView or its sections the searchBar looses firstResponder and the keyboard is dismissed.</li>
  <li>I have added an extras section to the collectionView which only shows its header (including the searchBar) bot not content. When reloading the other sections but keeping this &quot;search section&quot; the keyboard is dismissed.</li>
  <li>It makes no difference if <code>collectionView.performBatchUpdates</code> is used or not.</li>
  <li>Resetting the firstResponder Status after the collectionView or its sections does work. However in this case the keyboard is dismissed and re-appears immediately. Quick typing is not possible this way and the flashing of the keyboard is very annoying.</li>
  </ul>
  <p><strong>Is there any known clean approach to solve this?</strong></p>