Created
May 11, 2019 19:51
-
-
Save AlekseyPleshkov/b711affdfe2da60ef1f5ed3ef5400725 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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