Created
May 11, 2019 19:52
-
-
Save AlekseyPleshkov/383b1573bdbb302dbe4eebb22ad20cef 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
| /// Протокол логики презентации | |
| protocol HomePresentationLogic: class { | |
| /// Метод форматирования полученных данных с Interactor'a | |
| func presentUser(_ response: HomeModels.FetchUser.Response) | |
| } | |
| final class HomePresenter: HomePresentationLogic { | |
| /// Ссылка на логику отображения View Controller'a | |
| weak var viewController: HomeDisplayLogic? | |
| func presentUser(_ response: HomeModels.FetchUser.Response) { | |
| // Для примера отформатируем номер телефона | |
| let formattedPhone = response.userPhone.replacingOccurrences(of: "-", with: " ") | |
| // Создаем экземляр ViewModel для отправки в View Controller | |
| let viewModel = HomeModels.FetchUser.ViewModel(userPhone: formattedPhone, userEmail: response.userEmail) | |
| // Вызываем метод логики отображения у View Controller'a | |
| viewController?.displayUser(viewModel) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment