Skip to content

Material design styled search UI consists of search bar and search results view.

License

Notifications You must be signed in to change notification settings

twho/material-design-search-ui-ios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Material Design Search UI iOS

Material design styled search UI consists of search bar and search results view.

Generic badge Generic badge Generic badge Generic badge

overview

You may see the following Medium articles for detailed explanation of developing these UI widgets.

Key Features

  • A Material Design search bar with delegation method for view controller use.
  • A Material Design and enum-driven search results view that clearly defines results view states.
  • Widget classes are made to be open, which gives you flexibility to create your own.
  • A simple location searching application using the above two widgets is included in the project.

Requirements

  • Swift 5.0
  • iOS 11.0+

Usage

Search bar

Declaration

var searchbar: Searchbar!
searchbar = Searchbar(
    onStartSearch: {
        // Your implementation
    },
    onClearInput: { 
        // Your implementation
    },
    delegate: self
)

Delegate methods

extension MainViewController: SearchbarDelegate {

    func searchbarTextDidChange(_ textField: UITextField) {
    
    }
    
    func textFieldDidBeginEditing(_ textField: UITextField) {
    
    }

    func textFieldDidEndEditing(_ textField: UITextField) {
    
    }

    func searchbarTextShouldReturn(_ textField: UITextField) -> Bool {
        return true
    }
}

button

Search results view

Declaration

var searchResultsView: SearchResultsView!
searchResultsView = SearchResultsView(didSelectAction: { 
    // Your implementation
})

button

Load data into results view

searchResultsView.update(newPlacemarks: placemarks, error: error)

Note: I use CLPlacemark here, you can change to whatever data type you'd like to use in your app.

Credits

About

Material design styled search UI consists of search bar and search results view.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published