SearchBar SwiftUI is a small example project that demonstrates how to embed a UIKit UISearchBar inside a SwiftUI view and use it to filter a list in real time. It wraps UISearchBar with UIViewRepresentable and a Coordinator, bridging the search text back into SwiftUI through a @Binding. As the user types, an ObservableObject view model filters the data set case-insensitively and updates the displayed List.
- 🔎 Live, case-insensitive filtering of a string array as you type
- 🌉 UIKit
UISearchBarbridged into SwiftUI viaUIViewRepresentable - 🧩
CoordinatorimplementingUISearchBarDelegateto relay text changes - 🔗 Two-way data flow using a
@Bindingand an@Publishedsearch text - 📋 MVVM-style
ViewModel(ObservableObject) driving a SwiftUIList
git clone https://github.com/ahmetbostanciklioglu/SearchBarSwiftUI.git
cd SearchBarSwiftUI
open SearchBarSwiftUI.xcodeprojOpen the project in Xcode, select an iOS Simulator, and press Cmd + R to build and run.
- iOS 26.1+
- Xcode 26+
- Swift 5.0
Ahmet Bostancıklıoğlu — @ahmetbostanciklioglu · ahmetbostancikli@gmail.com
⭐ If this helped you, consider giving the repo a star!

