I would like to ask how can I search with multiple filters in searchDisplayController
here is my method:
func filterContentForSearchText(searchText: String, scope: String = "All") {
// Filter the array using the filter method
self.filteredCandies = self.person.filter({( candy: Candy) -> Bool in
let categoryMatch = (scope == "All") || (candy.category == scope)
let stringMatch = candy.name.rangeOfString(searchText)
return categoryMatch && (stringMatch != nil)
Aucun commentaire:
Enregistrer un commentaire