Skip to content

sentryco/SearchBarKit

Repository files navigation

Tests codebeat badge

SearchBarKit

Sleek searchbar for iOS and macOS

img

Features

  • Focus triggers callback and receeded look and feel
  • Text change triggers callback
  • Customizable sizing and color theme (via struct injection)
  • Works for iOS and macOS
  • Dark / light mode

Example

SearchBar(
   placeholderText: "Search...", // Placeholder text
   onFocus: { // Triggered when searchfield is focused
      Swift.print("isFocused: \($0)")
   }, onTextChange: { // Triggered when text changes
      Swift.print("text: \($0)")
   }
)

Installation

Add to your project using Swift Package Manager by adding the following URL:

.package(url: "https://github.com/sentryco/SearchBarKit", branch: "main")

Dependencies:

Todo

  • Maybe not hide close button on focus loss?
  • Add more comments with AI
  • Remove unit test, add uitest
  • It seems placeholder text-color for SearchBar text doesnt work for macOS. Try to fix it

Future improvments:

  • Add SearchBarIdentifier (injectable accessid) (for now these are hardcoded)
  • Move more metrics to const (later when it makes sense)

About

Sleek searchbar for iPad and macOS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages