I am getting the error 'Extra Argument in Call' when I am trying to implement a search bar into my app.
I have read other questions that include:
Swift - Extra Argument in call
Swift 4 “Extra argument in call” Rxswift
And others but have come up with no success.
Here is my code:
extension ViewController: UISearchBarDelegate {
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
todoItems = todoItems.filter("title CONTAINS[cd] %@", searchBar.text!).sorted(byKeyPath: "dateCreated", ascending: true) // Getting Error on this line
tableView.reloadData()
}
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
if searchBar.text?.count == 0 {
loadItems()
DispatchQueue.main.async {
searchBar.resignFirstResponder()
}
}
}
}