extension tableviewtest: UISearchBarDelegate {
func searchBar (_ searchBar:UISearchBar, textDidChange searchText: String) {
searchArr = copiedArray.filter({$0.prefix(searchText.count) == searchText})
searching = true
tableview.reloadData()
}
}
For example, copiedArray has some sentences. ["I love you.", "She's beautiful.", "She's a friend of mine."] when I type "she" into the searchBar, I see the two sentences that start with "she". but when I type "beautiful" or "friend". I don't see anything. How should I solve this?