-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/user profile scene viper #89
base: main
Are you sure you want to change the base?
Feature/user profile scene viper #89
Conversation
func fetchUserProfile() | ||
} | ||
|
||
protocol UserProfileInteractorOutput: AnyObject { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adicionar weak self
pra evitar retain cycle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retornar o tamanho do array.
} | ||
|
||
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { | ||
return "My account" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Salvar numa constante na Presenter
} | ||
} | ||
|
||
extension UserProfilePresenter: UITableViewDelegate { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remover protocolos vazios não implementados
weak var view: UserProfileViewController? | ||
|
||
func createModule() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retornar o output do Factory aqui.
|
||
} | ||
|
||
func navigate() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pode remover este método.
Descrição simples da nova feature
Implement viper on user profile screen.
Checklist:
Coloque um
x
nas caixas que se aplicam.Evidências da feature: