Skip to content

Instantly share code, notes, and snippets.

@lukeredpath
Last active October 7, 2015 14:30
Show Gist options
  • Save lukeredpath/a969aa97fab9705ef77a to your computer and use it in GitHub Desktop.
Save lukeredpath/a969aa97fab9705ef77a to your computer and use it in GitHub Desktop.
Protocol defaults?
protocol Search: UISearchResultsUpdating {
func searchFor(query: String)
}
extension Search {
func updateSearchResultsForSearchController(searchController: UISearchController) {
searchFor(searchController.searchBar.text!)
}
}
@objc class GoogleSearch: NSObject, Search {
func searchFor(query: String) {
// do stuff
}
}
# Error: Type 'GoogleSearch' does not conform to protocol 'UISearchResultsUpdating'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment