{"id":2958,"url":"https://github.com/PhilippeBoisney/ModernSearchBar","last_synced_at":"2025-08-03T12:31:44.501Z","repository":{"id":62447940,"uuid":"84091366","full_name":"PhilippeBoisney/ModernSearchBar","owner":"PhilippeBoisney","description":"The famous iOS search bar with auto completion feature implemented.","archived":false,"fork":false,"pushed_at":"2020-02-03T14:00:14.000Z","size":42218,"stargazers_count":185,"open_issues_count":12,"forks_count":37,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-24T01:41:35.580Z","etag":null,"topics":["autocomplete","autocompletion","ios","search","searchbar","suggestions","swift","swift3","uisearchbar","url"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PhilippeBoisney.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-06T15:48:06.000Z","updated_at":"2024-06-24T11:04:30.000Z","dependencies_parsed_at":"2022-11-01T23:17:25.821Z","dependency_job_id":null,"html_url":"https://github.com/PhilippeBoisney/ModernSearchBar","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippeBoisney%2FModernSearchBar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippeBoisney%2FModernSearchBar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippeBoisney%2FModernSearchBar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippeBoisney%2FModernSearchBar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PhilippeBoisney","download_url":"https://codeload.github.com/PhilippeBoisney/ModernSearchBar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228543228,"owners_count":17934447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autocomplete","autocompletion","ios","search","searchbar","suggestions","swift","swift3","uisearchbar","url"],"created_at":"2024-01-05T20:16:27.414Z","updated_at":"2024-12-07T00:31:08.885Z","avatar_url":"https://github.com/PhilippeBoisney.png","language":"Swift","funding_links":[],"categories":["UI"],"sub_categories":["TextField \u0026 TextView","Other free courses"],"readme":"\u003cp\u003e\n \u003cimg src =\"https://github.com/PhilippeBoisney/ModernSearchBar/raw/master/Examples%20Url/bandeau.png\"/\u003e\n\u003c/p\u003e\n\n[![Platform](http://img.shields.io/badge/platform-ios-blue.svg?style=flat\n)](https://developer.apple.com/iphone/index.action)\n[![Language](http://img.shields.io/badge/language-swift-brightgreen.svg?style=flat\n)](https://developer.apple.com/swift)\n[![License](http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat\n)](http://mit-license.org)\n\n## PRESENTATION\nThis search bar will allow you to offer suggestions words to your users when they are looking for something using default iOS search bar. Enjoy it !\n\n\n## DEMO\n**Two ways to use this lib :** \n- One with a simple array of string (Array\u0026#60;String\u0026#62;)\n- The other with an array of custom object (Array\u0026#60;ModernSearchBarModel\u0026#62;) if you want to get image of each row from an url.\n\nSIMPLE  |  ADVANCED\n:-------------------------:|:-------------------------:\n![](https://github.com/PhilippeBoisney/ModernSearchBar/raw/master/Gifs/Gif_simple_list.gif)  |  ![](https://github.com/PhilippeBoisney/ModernSearchBar/raw/master/Gifs/Gif_complex_list.gif)\n\n## INSTALLATION\n#### CocoaPods\nYou can use [CocoaPods](http://cocoapods.org/) to install `ModernSearchBar` by adding it to your `Podfile`:\n```\npod 'ModernSearchBar'\n```\n#### Manually\n1. Download and drop all *.swift files contained in Pod folder in your project.\n2. Don't forget to import the assets folder too.\n3. Enjoy !  \n\n\n## USAGE\n### 1 - Configure StoryBoard (Custom Class)\n\u003cp align=\"center\"\u003e\n \u003cimg src =\"https://github.com/PhilippeBoisney/ModernSearchBar/raw/master/Examples%20Url/usage_1.png\", height=300/\u003e\n\u003c/p\u003e\n\n### 2 - Configure ViewController\n\n\n```swift\n//Import lib on the top of ViewController\nimport ModernSearchBar\n\n//Create an IBOutlet from your searchBar\n @IBOutlet weak var modernSearchBar: ModernSearchBar!\n\n//Extend your ViewController with 'ModernSearchBarDelegate'\nclass ViewController: UIViewController, ModernSearchBarDelegate\n\n//Implement the delegation\nself.modernSearchBar.delegateModernSearchBar = self\n\n//Set datas to fill the suggestionsView of the searchbar.\n//Two ways (you have to choose only one, you can't implement both obviously)\n\n// 1 - With an Array\u003cString\u003e\nvar suggestionList = Array\u003cString\u003e()\nsuggestionList.append(\"Onions\")\nsuggestionList.append(\"Celery\")\n\nself.modernSearchBar.setDatas(datas: suggestionList)\n\n// 2 - With custom Array\u003cModernSearchBarModel\u003e\nvar suggestionListWithUrl = Array\u003cModernSearchBarModel\u003e()\nsuggestionListWithUrl.append(ModernSearchBarModel(title: \"Alpha\", url: \"https://github.com/PhilippeBoisney/ModernSearchBar/raw/master/Examples%20Url/exampleA.png\"))\nsuggestionListWithUrl.append(ModernSearchBarModel(title: \"Bravo\", url: \"https://github.com/PhilippeBoisney/ModernSearchBar/raw/master/Examples%20Url/exampleB.png\"))\n\nself.modernSearchBar.setDatasWithUrl(datas: suggestionListWithUrl)\n\n```\n## DELEGATE\nModernSearchBarDelegate inherit from UISearchBarDelegate, so you can find commons methods you already use in your project. Also, I add those methods to handle click actions on suggestionsView.\n ```swift\n\n///Called if you use String suggestion list\nfunc onClickItemSuggestionsView(item: String) {\n    print(\"User touched this item: \"+item)\n}\n\n///Called if you use Custom Item suggestion list\nfunc onClickItemWithUrlSuggestionsView(item: ModernSearchBarModel) {\n    print(\"User touched this item: \"+item.title+\" with this url: \"+item.url.description)\n}\n\n///Called when user touched shadowView\nfunc onClickShadowView(shadowView: UIView) {\n    print(\"User touched shadowView\")\n}\n\n ```\n## CUSTOMIZING\n\n ```swift\n\n//Modify shadows alpha\nself.modernSearchBar.shadowView_alpha = 0.8\n\n//Modify the default icon of suggestionsView's rows\nself.modernSearchBar.searchImage = ModernSearchBarIcon.Icon.none.image\n\n//Modify properties of the searchLabel\nself.modernSearchBar.searchLabel_font = UIFont(name: \"Avenir-Light\", size: 30)\nself.modernSearchBar.searchLabel_textColor = UIColor.red\nself.modernSearchBar.searchLabel_backgroundColor = UIColor.black\n\n//Modify properties of the searchIcon\nself.modernSearchBar.suggestionsView_searchIcon_height = 40\nself.modernSearchBar.suggestionsView_searchIcon_width = 40\nself.modernSearchBar.suggestionsView_searchIcon_isRound = false\n\n//Modify properties of suggestionsView\n///Modify the max height of the suggestionsView\nself.modernSearchBar.suggestionsView_maxHeight = 1000\n///Modify properties of the suggestionsView\nself.modernSearchBar.suggestionsView_backgroundColor = UIColor.brown\nself.modernSearchBar.suggestionsView_contentViewColor = UIColor.yellow\nself.modernSearchBar.suggestionsView_separatorStyle = .singleLine\nself.modernSearchBar.suggestionsView_selectionStyle = UITableViewCellSelectionStyle.gray\nself.modernSearchBar.suggestionsView_verticalSpaceWithSearchBar = 10\nself.modernSearchBar.suggestionsView_spaceWithKeyboard = 20\n\n  ```\n\n## Version\n1.5\n\n## License\n\nCopyright 2017 Boisney Philippe\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. **Create New Pull Request**\n\n## Author\nPhilippe BOISNEY (phil.boisney(@)gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPhilippeBoisney%2FModernSearchBar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPhilippeBoisney%2FModernSearchBar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPhilippeBoisney%2FModernSearchBar/lists"}