Keep UISearchBar Shown when scrolling in UITableView (Swift)

I currently have a UISearchBar (code below) which works fine however I'm trying to make it so upon scrolling in my UITableView, my UISearchBar does not disappear. One of the things I've read is to embed a searchController into a view controller with the following line of code: 
Code Block
navigationItem.searchController = yourSearchController
and then to prevent the UISearchBar from hiding, add this line of code: 
Code Block
navigationItem.hidesSearchBarWhenScrolling = false
however it has not worked. I've also read to put the SearchBar above the UITableView in the View Hierarchy, but when I do that and place it below the Navigation Bar, upon scrolling it overlaps the tableView cells. Do I need a SearchController, and if so, how do I implement this? I've spent hours searching the internet for a solution, however, none of them have resolved my issue.

UISearchBar IBOutlet:
Code Block
@IBOutlet weak var searchBar: UISearchBar!


viewDidLoad Func:
Code Block
filteredData = data


UISearchBar Code:
Code Block func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
if searchText.isEmpty {
filteredData = data
} else {
filteredData = data.filter{$0.title.range(of: searchText, options: .caseInsensitive) != nil }
}
self.tableView.reloadData()
}
}


Regarding the View Hierarchy, the SearchBar is below the tableView


Let me know if you have any questions. Any response would be greatly appreciated, thanks!


Normally, you could call:
Code Block
navigationItem.hidesSearchBarWhenScrolling = false

Have a look here for much detailed discussion
https://stackoverflow.com/questions/34723301/search-bar-always-visible
I've already attempted adding this line of code, however, it did not resolve my problem. I believe I need to implement a UISearchController for this line of code to work. With my existing UISearchBar code, how would I implement a UISearchController, thanks.

how would I implement a UISearchController, thanks.

Please show enough code to check what's going on and find how to fix.

It may be very useful if you could show the full code of a simplified project which can reproduce the same issue.
Keep UISearchBar Shown when scrolling in UITableView (Swift)
 
 
Q