Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

🔍 SearchBar SwiftUI

A live-filtering search bar in SwiftUI, powered by a UIKit UISearchBar bridge

Platform Swift SwiftUI Xcode Stars Last Commit

📖 Overview

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.

✨ Features

  • 🔎 Live, case-insensitive filtering of a string array as you type
  • 🌉 UIKit UISearchBar bridged into SwiftUI via UIViewRepresentable
  • 🧩 Coordinator implementing UISearchBarDelegate to relay text changes
  • 🔗 Two-way data flow using a @Binding and an @Published search text
  • 📋 MVVM-style ViewModel (ObservableObject) driving a SwiftUI List

📸 Preview

Search bar with full list

Search bar filtering results

🚀 Getting Started

git clone https://github.com/ahmetbostanciklioglu/SearchBarSwiftUI.git
cd SearchBarSwiftUI
open SearchBarSwiftUI.xcodeproj

Open the project in Xcode, select an iOS Simulator, and press Cmd + R to build and run.

📋 Requirements

  • iOS 26.1+
  • Xcode 26+
  • Swift 5.0

🧑‍💻 Author

Ahmet Bostancıklıoğlu@ahmetbostanciklioglu · ahmetbostancikli@gmail.com

⭐ If this helped you, consider giving the repo a star!

About

A live-filtering SwiftUI search bar built by bridging a UIKit UISearchBar with UIViewRepresentable

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages