Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Christian A. Castro
29,605 PointsImplementing a Search Bar, Building an iTunes Search App! Any idea why the keyboard is not coming up on my end?
Here's my code:
import UIKit
class SearchResultsController: UITableViewController
{
let searchController = UISearchController(searchResultsController: nil)
override func viewDidLoad()
{
super.viewDidLoad()
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector (SearchResultsController.dismissSearchResultsController))
tableView.tableHeaderView = searchController.searchBar
//Dismissing backGround..
searchController.dimsBackgroundDuringPresentation = false
//Responsible for updating the content..
searchController.searchResultsUpdater = self
}
@objc func dismissSearchResultsController()
{
//This dismiss the viewController..
self.dismiss(animated: true, completion: nil)
}
}
extension SearchResultsController: UISearchResultsUpdating
{
func updateSearchResults(for searchController: UISearchController)
{
print(searchController.searchBar.text!)
}
}
1 Answer

Christian A. Castro
29,605 PointsNevermind! I was able to figure out! If any of your experience the same issue, press on your computer: Command + K, and it will bring it up in iOs Simulator. From that point forward, every single time you click on the search bar; it will show it up automatically!!
Hope this helps someone out there!
Amaury,
Xavier D
Courses Plus Student 5,840 PointsXavier D
Courses Plus Student 5,840 PointsI agree. Alternately, you can use the simulator's Hardware menu to toggle the Keyboard options.