{"id":18421411,"url":"https://github.com/rebeloper/searchbarview","last_synced_at":"2025-04-07T14:31:48.640Z","repository":{"id":169311213,"uuid":"330353254","full_name":"rebeloper/SearchBarView","owner":"rebeloper","description":"🔎 The missing UISearchBar from SwiftUI","archived":false,"fork":false,"pushed_at":"2021-01-27T11:44:44.000Z","size":1049,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T19:43:56.431Z","etag":null,"topics":["searchbarview","swiftui","swiftui-searchbar","swiftui-searchbarview","uisearchbar","uisearchbardelegate","uisearchbardelegate-swiftui","uisearchcontrol","uisearchcontroller","uisearchcontroller-swiftui"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rebeloper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-17T09:13:46.000Z","updated_at":"2024-04-20T16:46:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"62accff8-2965-484e-9353-f91904ac3d3e","html_url":"https://github.com/rebeloper/SearchBarView","commit_stats":null,"previous_names":["rebeloper/searchbarview"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rebeloper%2FSearchBarView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rebeloper%2FSearchBarView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rebeloper%2FSearchBarView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rebeloper%2FSearchBarView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rebeloper","download_url":"https://codeload.github.com/rebeloper/SearchBarView/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247669920,"owners_count":20976477,"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":["searchbarview","swiftui","swiftui-searchbar","swiftui-searchbarview","uisearchbar","uisearchbardelegate","uisearchbardelegate-swiftui","uisearchcontrol","uisearchcontroller","uisearchcontroller-swiftui"],"created_at":"2024-11-06T04:25:35.518Z","updated_at":"2025-04-07T14:31:48.605Z","avatar_url":"https://github.com/rebeloper.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔎 SearchBarView\n\n![swift v5.3](https://img.shields.io/badge/swift-v5.3-orange.svg)\n![platform iOS](https://img.shields.io/badge/platform-iOS-blue.svg)\n![deployment target iOS 14](https://img.shields.io/badge/deployment%20target-iOS%2014-blueviolet)\n\n**SearchBarView** is a lightweight library that creates a native `SwiftUI` search bar similar to the `UISearchBar`.\n\n## 💻 Installation\n### 📦 Swift Package Manager\nUsing \u003ca href=\"https://swift.org/package-manager/\" rel=\"nofollow\"\u003eSwift Package Manager\u003c/a\u003e, add it as a Swift Package in Xcode 11.0 or later, `select File \u003e Swift Packages \u003e Add Package Dependency...` and add the repository URL:\n```\nhttps://github.com/rebeloper/SearchBarView.git\n```\n### ✊ Manual Installation\nDownload and include the `SearchBarView` folder and files in your codebase.\n\n### 📲 Requirements\n- iOS 14+\n- Swift 5.3+\n\n## 👉 Import\n\nImport `SearchBarView` into your `View`\n\n```\nimport SearchBarView\n```\n\n## 🧳 Features\n\nHere's the list of the awesome features `SearchBarView` has:\n- [X] 100% `SwiftUI` code\n- [X] Bindable search text\n- [X] Callbacks: `onEditingChanged`, `onCommit` and `onCancel`\n- [X] Fully customizable\n\n## 💻 How to Use\n\nHere are the ways that you can create a new `SearchBarView`:\n\n```\n@State var searchText = \"\"\n\nvar body: some View {\n    VStack {\n        \n        SearchBarView(text: $searchText)\n        \n        SearchBarView(text: $searchText) {\n            print(\"onCancel\")\n        }\n        \n        SearchBarView(title: \"Type to search...\", text: $searchText) {\n            print(\"onCancel\")\n        }\n        \n        SearchBarView(title: \"Type to search...\", text: $searchText, font: .custom(\"American Typewriter\", size: 24), iconView: { () -\u003e AnyView in\n            AnyView(Image(systemName: \"wand.and.stars.inverse\").foregroundColor(Color(.orange)))\n        }, showsCancelButton: true, cancelButtonLabel: { () -\u003e AnyView in\n            AnyView(Image(systemName: \"xmark\").font(.system(size: 28, weight: .bold)).foregroundColor(.white))\n        }, showsClearSearchButton: true, clearSearchButtonLabel: { () -\u003e AnyView in\n            AnyView(Text(\"Clear\").bold().foregroundColor(.red))\n        }, textBackgroundView: { () -\u003e AnyView in\n            AnyView(RoundedRectangle(cornerRadius: 32).foregroundColor(Color(.secondarySystemBackground)))\n        }, backgroundView: { () -\u003e AnyView in\n            AnyView(Color.purple)\n        }, spacing: 16) { (isTyping) in\n            print(\"Is typing: \\(isTyping)\")\n        } onCommit: {\n            print(\"onCommit\")\n        } onCancel: {\n            print(\"onCancel\")\n        }\n        \n        Spacer()\n    }\n}\n```\n\nHere's the created view:\n\n\u003cimg src=\"../main/Sources/Resources/SearchBarView0.png\" width=\"350px\"\u003e\n\nAnd when the user has typed something:\n\n\u003cimg src=\"../main/Sources/Resources/SearchBarView1.png\" width=\"350px\"\u003e\n\nAlso in Dark Appearance:\n\n\u003cimg src=\"../main/Sources/Resources/SearchBarView2.png\" width=\"350px\"\u003e\n\n\u003cimg src=\"../main/Sources/Resources/SearchBarView3.png\" width=\"350px\"\u003e\n\n## ✍️ Contact\n\n\u003ca href=\"https://rebeloper.com/\"\u003erebeloper.com\u003c/a\u003e / \n\u003ca href=\"https://www.youtube.com/rebeloper/\"\u003eYouTube\u003c/a\u003e / \n\u003ca href=\"https://store.rebeloper.com/\"\u003eShop\u003c/a\u003e / \n\u003ca href=\"https://rebeloper.com/mentoring\"\u003eMentoring\u003c/a\u003e\n\n## 📃 License\n\nThe MIT License (MIT)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frebeloper%2Fsearchbarview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frebeloper%2Fsearchbarview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frebeloper%2Fsearchbarview/lists"}