Check Mobile App
Read now

Implement UISearchController with Custom UIViewController Support in Swift 4.2

Save

UISearchController with Custom UIViewController Support

Sometimes we need to use search suggestion within the same page that will show over the current screen for that we can use UISearchController with one Target Controller, for this follow these steps.

Here we are taking  2 controllers where one controller loads another controller over the screen.

1: Define First Controller:

Create A UIview On controller  & create their outlet.

Now write this code on ViewDidLoad()

Note: here  “TableViewControllerClass” is another UITableViewController class that will load when the user click on the search bar.

2:Define the  TableViewControllerClass

 

 

Note: ” func updateSearchResults(for searchController: UISearchController)”  this method will call every time when the user clicks on search bar & type on search bar so this method will help to reload the data or update the data in that controller.

Now it will look like this:

 

 

 

 

 

 

 

 

 

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php

Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!

Deniel Kerr

Owner and Founder. Opencart

Talk to Sales
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home