in FriendlyEats/RestaurantsTableViewController.swift [228:258]
func controller(_ controller: FiltersViewController,
didSelectCategory category: String?,
city: String?,
price: Int?,
sortBy: String?) {
let filtered = query(withCategory: category, city: city, price: price, sortBy: sortBy)
if let category = category, !category.isEmpty {
categoryFilterLabel.text = category
categoryFilterLabel.isHidden = false
} else {
categoryFilterLabel.isHidden = true
}
if let city = city, !city.isEmpty {
cityFilterLabel.text = city
cityFilterLabel.isHidden = false
} else {
cityFilterLabel.isHidden = true
}
if let price = price {
priceFilterLabel.text = priceString(from: price)
priceFilterLabel.isHidden = false
} else {
priceFilterLabel.isHidden = true
}
self.query = filtered
observeQuery()
}