QuickSearch

0.2.1

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

2024-05-29T14:27:41Z

This version adds support for strict concurrency.

QuickSearch Logo

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

About QuickSearch

QuickSearch is a SwiftUI SDK that lets you type into a .searchable text field without first having to focus on it, which is how many native utilty apps behave.

This is convenient, since .searchable text fields lack focus control and doesn't allow you to focus programmatically.

Installation

QuickSearch can be installed with the Swift Package Manager:

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

Getting Started

All you have to do to make QuickSearch work, is to apply a .quickSearch view modifier after .searchable:

 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)
         }
     }
}

If you can add .quickSearch directly next to .searchable, you can use .searchable(text:quickSearch:...) instead. It is not as flexible as .searchable, but works well to apply basic .searchable capabilities.

For more information, please see the documentation.

Documentation

The online documentation has more information, articles, code examples, etc.

Demo Application

The demo app lets you explore the library. To try it out, just open and run the Demo project.

Support my work

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

Your support makes it possible for me to put more work into these projects and make them the best they can be.

Contact

Feel free to reach out if you have questions or 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: Sat Oct 05 2024 03:11:26 GMT-0900 (Hawaii-Aleutian Daylight Time)