How to: Add a search bar to NavigationView in SwiftUI

NavigationView SearchBar Image
NavigationView SearchBar


In the latest version of iOS 15 sdk, you can now use the .searchable(:) modifier to achieve search behavior. Only continue with this article…




Co-founder of

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

SwiftUI Tutorial: Adding Gestures

Xamarin Tips: Xamarin.iOS Binding with SecKey API

Understanding @StateObject in SwiftUI for iOS 14

Importing 3D models into Xcode to make interactive Games and interfaces for iOS?

Agora Releases Native SDK v3.6.2

Agora release banner

iOS — Loading remote image asynchronously with Image Cache support.

Adding multiple projects in one Xcode project

Placing ARKit objects with code

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gary Tokman

Gary Tokman

Co-founder of

More from Medium

iOS simple painting App — demonstration in Swift, SwiftUI and RxSwift

Simple painting App preview

Build an iOS Weather SwiftUI App

SwiftUI | AsyncImage With Loader

iPhone displaying images with the SwiftUI logo

How to preview UIViewControllers using SwiftUI