QuickSearch

0.1.2

QuickSearch is a SwiftUI SDK that lets you type into a searchable text field without first having to focus on it.
danielsaidi/QuickSearch

What's New

2023-12-19T20:49:02Z

💡 Behavior Changes

  • Pressing escape now resets the search field.
  • Quick search now ignores any modified pressed.
  • iOS & macOS now uses two different quick search approaches.

🐛 Bug Fixes

  • Backspace now works on both iOS and macOS.

QuickSearch Logo

Version Swift 5.9 Swift UI MIT License Twitter: @danielsaidi Mastodon: @danielsaidi@mastodon.social

About QuickSearch

QuickSearch lets type into a searchable text fields by typing on the keyboard without first having to focus on the text field.

QuickSearch can be enabled by applying a quickSearch modifier to a view hierarchy that contains a .searchable view modifier:

 struct ContentView: View {
 
     @State
     var query = ""
     
     @State
     var text = ""
 
     @FocusState
     var isTextFieldFocused
    
     var body: some View {
         NavigationStack {
             VStack {
                TextField("Type here...", text: $text)
             }
             .quickSearch(text: $query)
             .searchable(text: $query)
         }
     }
}

When the app launches, the user can now start typing on the keyboard without first focusing on the search text field.

Installation

QuickSearch can be installed with the Swift Package Manager:

https://github.com/danielsaidi/QuickSearch.git

If you prefer to not have external dependencies, you can also just copy the source code into your app.

Support my work

You can sponsor me on GitHub Sponsors or reach out for paid support, to help support my open-source projects.

Contact

Feel free to reach out if you have questions or if you want to contribute in any way:

License

QuickSearch is available under the MIT license. See the LICENSE file for more info.

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri Apr 26 2024 15:36:18 GMT-0900 (Hawaii-Aleutian Daylight Time)