You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.2 KiB

  1. //
  2. // ExchangeRatesPresenter.swift
  3. // GMERemittance
  4. //
  5. // Created by gme_2 on 24/08/2018.
  6. //Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. class ExchangeRatesPresenter {
  10. // MARK: Properties
  11. weak var view: ExchangeRatesViewInterface?
  12. var interactor: ExchangeRatesInteractorInput?
  13. var wireframe: ExchangeRatesWireframeInput?
  14. // MARK: Converting entities
  15. }
  16. // MARK: ExchangeRates module interface
  17. extension ExchangeRatesPresenter: ExchangeRatesModuleInterface {
  18. func fetchExchangeRate() {
  19. view?.showLoading()
  20. interactor?.fetchExchangeRate()
  21. }
  22. func exchangeCalculate(use model: ExchangeRateRequestModel) {
  23. view?.showLoading()
  24. interactor?.exchangeCalculate(use: model)
  25. }
  26. }
  27. // MARK: ExchangeRates interactor output interface
  28. extension ExchangeRatesPresenter: ExchangeRatesInteractorOutput {
  29. func setModel(with model: [ExchangeRateModel]?) {
  30. view?.hideLoading()
  31. view?.setModel(with: model)
  32. }
  33. func setModel(with model: ExchangeRateDetailModel?) {
  34. view?.hideLoading()
  35. view?.setModel(with: model)
  36. }
  37. func setError(with error: Error) {
  38. view?.hideLoading()
  39. view?.setError(with: error)
  40. }
  41. }