Created the ActivityDetailsView screen#77
Created the ActivityDetailsView screen#77Brun41v35 wants to merge 8 commits intodevpass-tech:mainfrom
Conversation
| return stack | ||
| }() | ||
|
|
||
| private lazy var productView: UIView = { |
There was a problem hiding this comment.
Dá pra resumir com uma inicialização simples
| private lazy var mainStack: UIStackView = { | ||
| let stack = UIStackView() | ||
| stack.axis = .vertical | ||
| stack.distribution = .fillEqually |
There was a problem hiding this comment.
Aqui dá pra remover já que os componentes tem instrinsicContentSize
| return view | ||
| }() | ||
|
|
||
| private lazy var productValueView: UIView = { |
| private lazy var productNameLabel: UILabel = { | ||
| let label = UILabel() | ||
| label.textAlignment = .center | ||
| label.font = UIFont.boldSystemFont(ofSize: 17) |
There was a problem hiding this comment.
Dá pra salvar o tamanho da fonte numa constante
There was a problem hiding this comment.
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 = { |
| return label | ||
| }() | ||
|
|
||
| private lazy var productValue: UILabel = { |
|
|
||
| private lazy var productValue: UILabel = { | ||
| let label = UILabel() | ||
| label.font = UIFont.boldSystemFont(ofSize: 34) |
|
|
||
| private lazy var reportButton: UIButton = { | ||
| let button = UIButton() | ||
| button.layer.cornerRadius = 14 |
| private lazy var reportButton: UIButton = { | ||
| let button = UIButton() | ||
| button.layer.cornerRadius = 14 | ||
| button.backgroundColor = .systemBlue |
There was a problem hiding this comment.
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) |
| }() | ||
|
|
||
| override var hierarchies: [BaseViewHierarchy] { | ||
| return [BaseViewHierarchy.init(parentView: self, subViews: [mainStack, reportButton]), |
| BaseViewHierarchy.init(parentView: productValueView, subViews: [productValue, purchaseTime])] | ||
| } | ||
|
|
||
| override var constraints: [NSLayoutConstraint] { |
There was a problem hiding this comment.
Salvar as constantes das constraints em Constants
There was a problem hiding this comment.
Pular linha e deixar um comentário pra cada componente que adiciona constraints.
|
|
||
| productImage.centerXAnchor.constraint(equalTo: centerXAnchor), | ||
|
|
||
| productNameLabel.centerXAnchor.constraint(equalTo: centerXAnchor), |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
O botão poderia ter um intrinsicContentSize.
Description
Created the ActivityDetailsView screen 📝
Videos
Simulator.Screen.Recording.-.iPhone.14.-.2022-12-12.at.17.23.58.mp4