Material design styled search UI consists of search bar and search results view.
Material design styled search UI consists of search bar and search results view.
You may see the following Medium articles for detailed explanation of developing these UI widgets.
var searchbar: Searchbar!
searchbar = Searchbar(
onStartSearch: {
// Your implementation
},
onClearInput: {
// Your implementation
},
delegate: self
)
extension MainViewController: SearchbarDelegate {
func searchbarTextDidChange(_ textField: UITextField) {
}
func textFieldDidBeginEditing(_ textField: UITextField) {
}
func textFieldDidEndEditing(_ textField: UITextField) {
}
func searchbarTextShouldReturn(_ textField: UITextField) -> Bool {
return true
}
}
var searchResultsView: SearchResultsView!
searchResultsView = SearchResultsView(didSelectAction: {
// Your implementation
})
searchResultsView.update(newPlacemarks: placemarks, error: error)
Note: I use CLPlacemark here, you can change to whatever data type you'd like to use in your app.