0
votes

I use the searchController to get a good user experience when searching through a list of all users. However I want the user to the see the unfiltered list of users when he enters the searchController. By now, as written in the title, the unfiltered results are only presented after I tap inside the searchbar. Before that, the tableview is empty. If I then push the build in cancel button, the unfiltered Data stays. The search function is working perfectly fine, but this bugs makes it useless in terms of user experience.

I've read that the searchController may cover the tableview at the beginning, but first of all I don't know if this is true and second, I have no idea how to avoid it.

Has anyone an idea how to solve this issue?

1

1 Answers

0
votes

You can force the UISearchController to display itself by setting its isActive property. https://developer.apple.com/documentation/uikit/uisearchcontroller/1618659-isactive

When the user taps in the search field of a managed search bar, the search controller automatically displays the search results controller. Usually, you get the value of this property to determine whether the search results are displayed. However, you can set this property to true to force the search interface to appear, even if the user has not tapped in the search field.

The default value of this property is false.