问题
Trying to add a header SearchBar CollectionView, but get an error:
Illegal Configuration: Connection "searchBar" cannot have a prototype object as its destination.
回答1:

arrange your view like this, and its related delegate methods.
回答2:
Try to add the "searchBar" above the collection view not upon the header of the collection view. Think if the collectionView has multiple sections, it will definitely cause a problem while scrolling the collectionView, hence you need to add the searchBar just above the collectionView not upon it's header.
来源:https://stackoverflow.com/questions/25460764/how-to-add-searchbar-in-collectionview