Skip to content
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

implement navbutton to userProfile #75

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

GusRigor
Copy link

@GusRigor GusRigor commented Dec 12, 2022

ProfileButtonView
Simulator Screen Shot - iPhone 11 - 2022-12-13 at 10 44 37


override init(frame: CGRect) {
super.init(frame: frame)
setupHierarchy()
Copy link

@Brun41v35 Brun41v35 Dec 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opa @GusRigor, acha que seria interessante criar uma função chamada setup() onde teria esse dois métodos ? E no caso, dentro do init chamariamos apenas o setup() assim deixaríamos o init mais "limpo" :D

Suggested change
setupHierarchy()
func setup() {
setupHierarchy()
setupConstraints()
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alterado.

setupHierarchy()
setupConstraints()
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opa, aqui talvez poderiamos colocar o @available(*,unavailable). O que acha ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Colocado. Faz sentido.

override public func configureView(_ viewModel: ViewModel?) {
// Configure
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opa @GusRigor, poderiamos remover esse espaço a mais ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

É uma prática que eu curto fazer. (Coisa de maluco). A ideia é ter uma linha a mais no começo e no final para fica mais fácil de ver até onde é classe até onde é implementação de função. Me ajuda na hora de bater o olho e ver o código verticalmente.

Mas se quiserem eu tiro.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhhh boa!! Olha, por mim pode deixar ☺️


import UIKit

class ProfileButtonView: CodeBaseView<ProfileButtonView.ViewModel> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[QUESTION]
Hmmm, aqui poderia ser final ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Faz todo sentido.

@GusRigor GusRigor force-pushed the feat/UserProfileButton branch from 61ebf50 to 3a978c7 Compare December 12, 2022 19:54
@@ -40,4 +41,17 @@ class HomeViewController: UIViewController {
override func loadView() {
self.view = homeView
}

private func setupProfileImage() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seria bom implementar esse bar button como uma variável ao invés de uma função.

struct ViewModel {
let image: String

init(image: String) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Como não é public, não precisa do init

}

enum Constants {
static let imageName: String = "avatar-placeholder"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Como é um conteúdo variável, pode ser injetado como propriedade


private lazy var profileButton: UIButton = {
let button = UIButton()
button.frame = CGRectMake(.zero, .zero, Constants.imageHeight, Constants.imageWidth)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tentar com intrinsicContentSize em vez do frame.

let button = UIButton()
button.frame = CGRectMake(.zero, .zero, Constants.imageHeight, Constants.imageWidth)
let image = UIImage(named: Constants.imageName)
if let image = image {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executar esse setup no configureViews

}

override public func configureView(_ viewModel: ViewModel?) {
// Configure

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementar o setup da view model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants