Search using UITextField

Viewed 4407

I have looked everywhere and there doesn't seem to be a clear example. I am trying to achieve this, where the textField will act as a searchBar then the user would be able to add that item: enter image description here

Most example seem to use UI SearchBar and a tableView where it displays the filtered results. But there is no real example that uses just a textField.

My other option is to try and just get an autocompletion where it checks if the character that is inputted matches an array of data, something like this:

Are there any clearer examples or tutorial I can follow? I'm fairly new to programming so I would prefer it be in Swift please.

Other similar reference:

http://www.iostutorialjunction.com/2017/04/integrate-search-functionality-in-ios-using-swift3.html

How to make UITextField behave like a UISearchBar in Swift?

https://www.raywenderlich.com/113772/uisearchcontroller-tutorial

http://www.matthewhsingleton.com/blog/2016/5/26/predictive-text-table-view-swift-version-of-ray-wenderlich

https://www.youtube.com/watch?v=YZ_S2GHFwW4

https://www.youtube.com/watch?v=XtiamBbL5QU&t=975s

Getting autocomplete to work in swift

https://github.com/EddyBorja/MLPAutoCompleteTextField

2 Answers

you can use an delegate method textFieldDidChangeSelection(_ textField: UITextField), works for me

Related