 <p>1.First thing is to conform to the UISearchbarDelegate.</p> <p>2.Set the search bar delegate to self.</p> <p>You can find more on this here <a href="http://shrikar.com/blog/2015/02/16/swift-ios-tutorial-uisearchbar-and-uisearchbardelegate/" rel="nofollow">Swift iOS tutorial : Implementing search using UISearchBar and UISearchBarDelegate</a></p>