Monday, November 9, 2026
HomeiOS Developmentios - How one can enter searchBar to the tableview

ios – How one can enter searchBar to the tableview

[ad_1]

I am making an attempt to implement searchBar to my tableView, however have some points. Right here is my information: var activeStates: [ActiveState] = [] Additionally created for search: var searchedArray: [ActiveState] = []Right here is strategies, which I am making an attempt to make use of:

func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
        searchedArray = activeStates.filter({$0.lowerCased().prefix(searchText.depend) == searchText.lowercased()})
        looking = true
        tableView.reloadData()
    }
    
    func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
        looking = false
        searchBar.textual content = ""
        tableView.reloadData()
    }

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments