Feature/user profile scene viper#89
Conversation
| func fetchUserProfile() | ||
| } | ||
|
|
||
| protocol UserProfileInteractorOutput: AnyObject { |
There was a problem hiding this comment.
Seria bom ter um método pra retornar um erro para a Presenter e apresentar alguma interface de erro na tela.
| extension UserProfileInteractor: UserProfileInteractorInput { | ||
|
|
||
| func fetchUserProfile() { | ||
| service.fetchUserProfile { userProfile in |
There was a problem hiding this comment.
Adicionar weak self pra evitar retain cycle
There was a problem hiding this comment.
Também fazer uma verificação da própria instância por meio de guard let self
|
|
||
| import UIKit | ||
|
|
||
| protocol UserProfilePresenterInput { |
There was a problem hiding this comment.
OBS: Esses dois métodos podem estar num protocolo pai da Presenter
| } | ||
|
|
||
| protocol UserProfilePresenterOutput: AnyObject { | ||
| func updateUI(userProfileViewModel: UserProfileViewModel) |
There was a problem hiding this comment.
Apagar a propriedade privada userProfileViewModel da Presenter, ou deixá-la internal de modo que a View possa acessá-la e ser apenas notificada pra atualizar a interface por uma função vazia.
| private let interactor: UserProfileInteractorInput | ||
| private let router: UserProfileRouterInput | ||
|
|
||
| private var userProfileViewModel: UserProfileViewModel? { |
There was a problem hiding this comment.
Em vez de pegar cada dado da ViewModel dependendo do índice, não é melhor criar um array de chaves e valores e pra cada indexPath, você pega a chave e valor naquele índice e salva na célula?
|
|
||
| func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| let cell = UITableViewCell(style: .value1, reuseIdentifier: "Cell") | ||
| switch indexPath.row { |
There was a problem hiding this comment.
let cell = UITableViewCell() cell.textLabel.text = viewModel[indexPath.row].key cell.detailsLabel.text = viewModel[indexPath.row].value return cell
| } | ||
|
|
||
| func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| return 3 |
| } | ||
|
|
||
| func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { | ||
| return "My account" |
| } | ||
| } | ||
|
|
||
| extension UserProfilePresenter: UITableViewDelegate { |
There was a problem hiding this comment.
Remover protocolos vazios não implementados
| weak var view: UserProfileViewController? | ||
|
|
||
| func createModule() { | ||
|
|
|
|
||
| } | ||
|
|
||
| func navigate() { |
Descrição simples da nova feature
Implement viper on user profile screen.
Checklist:
Coloque um
xnas caixas que se aplicam.Evidências da feature: