Welcome to the forum.
You will find a lot of tutorials on how to implement a searchBar.
What is it you don't succeed in doing ? What is your present code ?
Please show the code that will help giving more precise answer
But principle is really simple:
struct ContentView: View { // This view is the side view
@State var searchText = ""
var data = [1,2,3,4,5,6,7,8,9,10]
var body: some View {
NavigationStack {
ScrollView(.vertical) {
ForEach(data, id: \.self) { d in
if searchText.isEmpty || String(d) == searchText {
Text("\(d)")
}
}
}
.navigationTitle("Search")
.searchable(text: $searchText)
}
}
}