Skip to content

Instantly share code, notes, and snippets.

@zafarivaev
Created January 5, 2020 12:08
Show Gist options
  • Save zafarivaev/a167b0cfc6fe4354a849d63afcba4b2d to your computer and use it in GitHub Desktop.
Save zafarivaev/a167b0cfc6fe4354a849d63afcba4b2d to your computer and use it in GitHub Desktop.
extension QuotesPresenter: InteractorToPresenterQuotesProtocol {
func fetchQuotesSuccess(quotes: [APIQuote]) {
print("Presenter receives the result from Interactor after it's done its job.")
self.quotesStrings = quotes.compactMap { $0.quote }
view?.hideHUD()
view?.onFetchQuotesSuccess()
}
func fetchQuotesFailure(errorCode: Int) {
print("Presenter receives the result from Interactor after it's done its job.")
view?.hideHUD()
view?.onFetchQuotesFailure(error: "Couldn't fetch quotes: \(errorCode)")
}
func getQuoteSuccess(_ quote: APIQuote) {
router?.pushToQuoteDetail(on: view!, with: quote)
}
func getQuoteFailure() {
view?.hideHUD()
print("Couldn't retrieve quote by index")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment