Вы можете создать горизонтально прокручиваемый collectionView с кнопками фильтров в них и установить его под UISearchController.
Вы можете программно создать представление коллекции следующим образом:
lazy var collectionView: UICollectionView = {
let layout = UICollectionViewFlowLayout()
layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
layout.minimumInteritemSpacing = 0
layout.scrollDirection = UICollectionViewScrollDirection.horizontal
let cv = UICollectionView(frame: .zero, collectionViewLayout: layout)
cv.backgroundColor = UIColor.white
cv.dataSource = self
cv.delegate = self
cv.translatesAutoresizingMaskIntoConstraints = false
return cv
}()
Теперь вы можете добавлять элементы в эту коллекцию, используя cellForItemAtIndexPath, numberOfItemsInSection и другие делегаты.
Вам потребуетсячтобы затем установить ограничения для collectionView следующим образом:
collectionView.leftAnchor.constraint(equalTo: self.view.leftAnchor).isActive = true
collectionView.rightAnchor.constraint(equalTo: self.view.rightAnchor).isActive = true
collectionView.topAnchor.constraint(equalTo: searchController.bottomAnchor).isActive = true
collectionView.heightAnchor.constraint(equalToConstant: 44).isActive = true
Дайте мне знать, если вам нужно дополнительное объяснение.