Refining search results in swift 3

81 views Asked by At

I have an app that has Uicollection view and each cell contains loads of details like username, location, availability date, price. So i want users to have the option to filter results according to their needs like search bar or text field for the selected date, another for location and other for price. and that means that i have to have multiple search bar or textfields my problem is that i know how to make Single search bar but i don't know how to make multiple. Any help would be very appericiated.

1

There are 1 answers

2
JuicyFruit On BEST ANSWER

you outlet UISearchBars to your UIViewController and then in delegate functions

func searchBar(searchBar: UISearchBar, textDidChange searchText: String) {
      if searchBar == self.searchBar1 {
          //first search bar used
      } else if searchBar == self.searchBar2 {
      ...
}