Twaha Mukammel
Twaha Mukammel

Reputation: 31

How to best use UISearchBar to search using API call, iOS

I have a huge list of elements, and only 50 is shown in table view through API paging. There is a search bar with the table view. When someone searches using the search bar, I need to use a search API. Is there a way to make this just like normal search experience as you would search through the table view elements per key press.

Upvotes: 1

Views: 2943

Answers (1)

Hooda
Hooda

Reputation: 1187

In case you want search to work with API call, you can follow the concept of reloading data after every few characters are typed (example : every 3 characters typed) in textDidChange method of UISearchBar.

Alternatively data can be reloaded when user stops typing. Refer to link in order to follow this approach.

By reloading, I mean the method which will actually perform the stuff you want to do after the user stops typing.

Upvotes: 0

Related Questions