You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 13, 2024. It is now read-only.
iOS 15 introduced .searchable(), which is an official search bar
implementation for SwiftUI. As such this project is now obsolete. I will
continue to keep it around as a polyfill for apps targeting <iOS 15, but it
will no longer be actively developed and you should switch to the new system as
soon as you can. Thank you all for your support, and happy coding!
SwiftlySearch
A small, lightweight UISearchController wrapper for SwiftUI
(#12) NavigationLinks inside the resultContent don't work. This is a limitation of the UIKit/SwiftUI interaction, and thus out of my hands. If you require a seperate view for displaying search results you can use a workaround like shown below:
structContentView:View{@StatevarsearchText:String=""varbody:someView{NavigationView{ZStack{if searchText.isEmpty {NormalView()}else{SearchResultsView(text: searchText)}}.navigationBarSearch($searchText)}}}structNormalView:View{varbody:someView{Text("Some view")}}structSearchResultsView:View{vartext:Stringvarbody:someView{VStack{Text("You searched for \(text)")NavigationLink(destination:Text(text)){Text("Let's go!")}}}}
About
A small, lightweight UISearchController wrapper for SwiftUI