Skip to content

Created the ActivityDetailsView screen #77

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No 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? No Sign in to your account

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

Conversation

Brun41v35
Copy link

@Brun41v35 Brun41v35 commented Dec 12, 2022

Description

Created the ActivityDetailsView screen 📝

Videos

Simulator.Screen.Recording.-.iPhone.14.-.2022-12-12.at.17.23.58.mp4

return stack
}()

private lazy var productView: UIView = {

Choose a reason for hiding this comment

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

Dá pra resumir com uma inicialização simples

private lazy var mainStack: UIStackView = {
let stack = UIStackView()
stack.axis = .vertical
stack.distribution = .fillEqually

Choose a reason for hiding this comment

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

Aqui dá pra remover já que os componentes tem instrinsicContentSize

return view
}()

private lazy var productValueView: UIView = {

Choose a reason for hiding this comment

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

Mesma coisa

private lazy var productNameLabel: UILabel = {
let label = UILabel()
label.textAlignment = .center
label.font = UIFont.boldSystemFont(ofSize: 17)

Choose a reason for hiding this comment

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

Dá pra salvar o tamanho da fonte numa constante

Choose a reason for hiding this comment

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

Outra coisa: Se a label comportar conteúdo grande, bom setar o número de linhas como zero.

return label
}()

private lazy var categoryNameLabel: UILabel = {

Choose a reason for hiding this comment

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

Mesma coisa aqui

return label
}()

private lazy var productValue: UILabel = {

Choose a reason for hiding this comment

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

Renomear pra productValueLabel


private lazy var productValue: UILabel = {
let label = UILabel()
label.font = UIFont.boldSystemFont(ofSize: 34)

Choose a reason for hiding this comment

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

Salvar em constantes


private lazy var reportButton: UIButton = {
let button = UIButton()
button.layer.cornerRadius = 14

Choose a reason for hiding this comment

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

Salvar em Constants

private lazy var reportButton: UIButton = {
let button = UIButton()
button.layer.cornerRadius = 14
button.backgroundColor = .systemBlue

Choose a reason for hiding this comment

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

Acho que seria bom usar a classe de botão que o Thyago criou.

let button = UIButton()
button.layer.cornerRadius = 14
button.backgroundColor = .systemBlue
button.setTitle("Report a issue", for: .normal)

Choose a reason for hiding this comment

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

Salvar a string numa constante

}()

override var hierarchies: [BaseViewHierarchy] {
return [BaseViewHierarchy.init(parentView: self, subViews: [mainStack, reportButton]),

Choose a reason for hiding this comment

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

OBS: Não precisa do return

BaseViewHierarchy.init(parentView: productValueView, subViews: [productValue, purchaseTime])]
}

override var constraints: [NSLayoutConstraint] {

Choose a reason for hiding this comment

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

Salvar as constantes das constraints em Constants

Choose a reason for hiding this comment

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

Pular linha e deixar um comentário pra cada componente que adiciona constraints.


productImage.centerXAnchor.constraint(equalTo: centerXAnchor),

productNameLabel.centerXAnchor.constraint(equalTo: centerXAnchor),

Choose a reason for hiding this comment

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

Sempre é bom colocar além do centro da label os limites.

reportButton.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 20),
reportButton.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor, constant: -15),
reportButton.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -20),
reportButton.heightAnchor.constraint(equalToConstant: 56)

Choose a reason for hiding this comment

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

O botão poderia ter um intrinsicContentSize.

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

Successfully merging this pull request may close these issues.

3 participants