I have a UICollectionViewController that maintains a recipes collection.
class RecipesViewController: UICollectionViewController, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
And another UICollectionViewController for maintaining results of the search, also implementing the UISearchResultsUpdating like that:
class SearchResultsController: UICollectionViewController, UISearchResultsUpdating,UICollectionViewDelegateFlowLayout, UICollectionViewDataSource { ...
I need to search into the collection, so I have a member into RecipesViewController
var searchController: UISearchController!
also initiated like that:
let resultsController = SearchResultsController()
resultsController.recipes = recipes
resultsController.filteredResults = recipes
searchController = UISearchController(searchResultsController: resultsController)
searchController.searchResultsUpdater = resultsController
I placed into the header of RecipesViewController the UISearchBar from searchController.
My problem is that SearchResultsController is not updating when text is entered into searchBar. Method updateSearchResultsForSearchController is not even called.