Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save AlekseyPleshkov/b711affdfe2da60ef1f5ed3ef5400725 to your computer and use it in GitHub Desktop.

Select an option

Save AlekseyPleshkov/b711affdfe2da60ef1f5ed3ef5400725 to your computer and use it in GitHub Desktop.
// Interactor
/// Протокол бизнес логики Interactor'a
protocol HomeBusinessLogic: class {
/// Метод получения данных из сети или других источников
func fetchUser(_ request: HomeModels.FetchUser.Request)
}
final class HomeInteractor: HomeBusinessLogic {
/// Ссылка на логику презентора сцены
var presenter: HomePresentationLogic?
func fetchUser(_ request: HomeModels.FetchUser.Request) {
// Здесь должен быть код получения данных
// Для примера просто создадим константы
let userPhone = "+7 (999) 111-22-33"
let userEmail = "im@alekseypleshkov.ru"
// ...
// Создаем запрос к Presentor'у с необходимыми данными
let response = HomeModels.FetchUser.Response(userPhone: userPhone, userEmail: userEmail)
// Вызываем метод логики презентации у Presentor'а
presenter?.presentUser(response)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment