```fun search(query: String) { view?.showLoadi...
# announcements
i
Copy code
fun search(query: String) {
    view?.showLoading()

    repository.getRecipes(query, object : RepositoryCallback<List<Recipe>> {
      override fun onSuccess(recipes: List<Recipe>?) {
        <mailto:this@SearchResultsPresenter.recipes|this@SearchResultsPresenter.recipes> = recipes
        if (recipes != null && recipes.isNotEmpty()) {
          view?.showRecipes(recipes)
        } else {
          view?.showEmptyRecipes()
        }
      }

      override fun onError() {
        view?.showError()
      }
    })
  }