HSSearchable
The easiest way to search from UITableView using UISearchBar or UISearchBarController in the minimum line of code.
Install / Use
/learn @hitendradeveloper/HSSearchableREADME
HSSearchable
Easiest way to search from UITableView using UISearchBar in minimum line of code in UIViewController

How to integreat source?
-
Directly drag and drop the HSSearchable.swift into your xcode project.
-
Most recommanded: install via cocoapods (How to use cocoapods)
pod 'HSSearchable'
How to use in code ? Just follow the simple steps :)
import HSSearchable
//Suppose this is your datamodel
struct UserDM {
var name: String
var city: String
}
-
extend your class or Structure using the SearchableData delegate
extension UserDM: SearchableData { var searchValue: String{ return self.name + " " + self.city //this will search from the name and city both //return self.name //this will search from the name only } } -
Create a variable of 'SearchableWrapper' in the viewController as property
var usersData = SearchableWrapper() var users: [UserDM] { //use this array as you are using array for your tableview controller return self.usersData.dataArray as! [UserDM] } -
Set the searchbar delegate and Searching callback
override func viewDidLoad() { super.viewDidLoad() self.searchbar.delegate = self.usersData self.usersData.searchingCallBack = { isSearching, searchText in print("searching Text:= \(searchText)") self.tableView.reloadData() } self.loadDummyData() } -
Set the local array or load data from the server usign API|Webservice call
func loadDummyData(){ //This is just an example data let user1 = UserDM(name: "Hitendra Solanki", city: "Ahmedabad") let user2 = UserDM(name: "Justina Flores", city: "Arizona") let user3 = UserDM(name: "Lisa Minick", city: "Casper") let user4 = UserDM(name: "Moises Patrick", city: "Reno") let user5 = UserDM(name: "Martha Fisher", city: "Tacoma") let user6 = UserDM(name: "Martha McDaniel", city: "Irvine") let array : Array<UserDM = [ user1, user2, user3, user4, user5, user6 ] //In most of the cases, this data will come from the server side self.usersData.serverArray = array; self.tableView.reloadData() } -
Optional Setps: HSSearchable also supports the optional customDelegate, using this you can handle default UISearchabarDelegate methods in your own viewControllers.
self.usersData.customDelegate = self //implement UISearchbarDelegate in your class
It's Done

Contact:
twitter: @hitendrahckr
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
