In swift 2.2
func filterContentForSearchText(searchText: String, scope: String) {
var resultPredicate = NSPredicate(format: "name contains[c] %@", searchText)
searchResults = (recipes as NSArray).filteredArrayUsingPredicate(resultPredicate)
}
In swift 3.0
func filterContent(forSearchText searchText: String, scope: String) {
var resultPredicate = NSPredicate(format: "name contains[c] %@", searchText)
searchResults = recipes.filtered(using: resultPredicate)
}