Hi tried to create a sort button with the CocoaPods Dropdown, the code doesn't show any error and the menu works, but if I click on the button nothing is happening.
dropDown.selectionAction = { [weak self] (index: Int, item: String) in //8
guard let _ = self else { return }
sender.setTitle(item, for: .normal) //9
let realm = try! Realm()
var books = realm.objects(Book.self).sorted(byKeyPath: "title", ascending: false)
if item == "sort by author" {
func filterResultsbyauthor(searchString: String){
let predicate = NSPredicate(format: "author BEGINSWITH [c]%@", searchString)
books = realm.objects(Book.self).filter(predicate).sorted(byKeyPath:"author", ascending: true)
self?.tableview.reloadData()
}
}
}