Skip to content

Instantly share code, notes, and snippets.

@zafarivaev
Created January 5, 2020 11:45
Show Gist options
  • Save zafarivaev/6f2df02db3f8f3fa5ff7933844f90877 to your computer and use it in GitHub Desktop.
Save zafarivaev/6f2df02db3f8f3fa5ff7933844f90877 to your computer and use it in GitHub Desktop.
import UIKit
// MARK: View Input (View -> Presenter)
protocol ViewToPresenterQuotesProtocol {
var view: PresenterToViewQuotesProtocol? { get set }
var interactor: PresenterToInteractorQuotesProtocol? { get set }
var router: PresenterToRouterQuotesProtocol? { get set }
var quotesStrings: [String]? { get set }
func viewDidLoad()
func refresh()
func numberOfRowsInSection() -> Int
func textLabelText(indexPath: IndexPath) -> String?
func didSelectRowAt(index: Int)
func deselectRowAt(index: Int)
}
// MARK: View Output (Presenter -> View)
protocol PresenterToViewQuotesProtocol {
func onFetchQuotesSuccess()
func onFetchQuotesFailure(error: String)
func showHUD()
func hideHUD()
func deselectRowAt(row: Int)
}
// MARK: Interactor Input (Presenter -> Interactor)
protocol PresenterToInteractorQuotesProtocol {
var presenter: InteractorToPresenterQuotesProtocol? { get set }
func loadQuotes()
func retrieveQuote(at index: Int)
}
// MARK: Interactor Output (Interactor -> Presenter)
protocol InteractorToPresenterQuotesProtocol {
func fetchQuotesSuccess(quotes: [APIQuote])
func fetchQuotesFailure(errorCode: Int)
func getQuoteSuccess(_ quote: APIQuote)
func getQuoteFailure()
}
// MARK: Router Input (Presenter -> Router)
protocol PresenterToRouterQuotesProtocol {
static func createModule() -> UINavigationController
func pushToQuoteDetail(on view: PresenterToViewQuotesProtocol, with quote: APIQuote)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment