Implementing Search Bar in Swift -


i have been trying implement search bar table view allow users search through transaction names.

this tutorial following: http://www.appcoda.com/search-bar-tutorial-ios7/

i have ran issues trying translate objective c code swift stuck @ 'filtercontentforsearchtext' line.

here code have search bar:

func filtercontentforsearchtext(searchtext: nsstring, scope: nsstring) {     let resultpredicate = nspredicate(format: "name contains[c] %@", searchtext)     searchresults = arraydatapayments.filteredarrayusingpredicate(resultpredicate)     println(searchresults) }  func searchdisplaycontroller(controller: uisearchdisplaycontroller!, shouldreloadtableforsearchstring searchstring: string!) -> bool {      self.filtercontentforsearchtext(searchstring, scope: self.searchdisplaycontroller.searchbar.scopebuttontitles)     return true } 

could let me know going wrong?

you might have this:

self.filtercontentforsearchtext(searchtext: searchstring, scope: self.searchdisplaycontroller.searchbar.scopebuttontitles[self.searchdisplaycontroller.searchbar.selectedscopebuttonindex]) 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -