Awesome Open Source
Awesome Open Source

SwiftUI Search Bar in Navigation Bar

SwiftUI (1) search bar in the navigation bar.

Complementary repository for article SwiftUI Search Bar in the Navigation Bar. For more details on motivations and implementation please refer to the full article, or lookup the basic usage example below otherwise.

struct ContentView: View
    var planets =
        ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"] +
        ["Ceres", "Pluto", "Haumea", "Makemake", "Eris"]
    @ObservedObject var searchBar: SearchBar = SearchBar()
    var body: some View {
        NavigationView {
            List {                
                    planets.filter {
                        searchBar.text.isEmpty ||
                    id: \.self
                ) { eachPlanet in


Licensed under the MIT License.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Swift (95,399
Ios (19,249
Swiftui (2,026
Uikit (1,566
Navigationbar (155
Related Projects