|
7 | 7 |
|
8 | 8 | import UIKit |
9 | 9 |
|
10 | | -final class UserProfileHeaderView: UIView { |
11 | | - |
12 | | - private lazy var stackViewProfile: UIStackView = { |
13 | | - let stack = UIStackView() |
14 | | - stack.translatesAutoresizingMaskIntoConstraints = false |
15 | | - stack.axis = .vertical |
16 | | - stack.spacing = 8 |
17 | | - stack.alignment = .center |
| 10 | +final class UserProfileHeaderView: UIStackView { |
18 | 11 |
|
19 | | - return stack |
20 | | - }() |
21 | | - |
22 | 12 | private lazy var profileImage: UIImageView = { |
23 | 13 | let image = UIImageView() |
24 | 14 | image.translatesAutoresizingMaskIntoConstraints = false |
@@ -77,33 +67,33 @@ final class UserProfileHeaderView: UIView { |
77 | 67 | } |
78 | 68 |
|
79 | 69 | @available(*, unavailable) |
80 | | - required init?(coder: NSCoder) { |
| 70 | + required init(coder: NSCoder) { |
81 | 71 | fatalError("init(coder:) has not been implemented") |
82 | 72 | } |
| 73 | + |
83 | 74 | } |
84 | 75 |
|
85 | 76 | extension UserProfileHeaderView: ViewCodable { |
86 | 77 |
|
87 | 78 | func buildHierarchy() { |
88 | | - addSubview(stackViewProfile) |
89 | | - stackViewProfile.addArrangedSubview(profileImage) |
90 | | - stackViewProfile.addArrangedSubview(titleLabel) |
91 | | - stackViewProfile.addArrangedSubview(agencyLabel) |
92 | | - stackViewProfile.addArrangedSubview(accountLabel) |
93 | | - stackViewProfile.addArrangedSubview(bankLabel) |
| 79 | + addArrangedSubview(profileImage) |
| 80 | + addArrangedSubview(titleLabel) |
| 81 | + addArrangedSubview(agencyLabel) |
| 82 | + addArrangedSubview(accountLabel) |
| 83 | + addArrangedSubview(bankLabel) |
94 | 84 | } |
95 | 85 |
|
96 | 86 | func setupConstraints() { |
97 | 87 | NSLayoutConstraint.activate([ |
98 | | - stackViewProfile.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor, constant: 16), |
99 | | - stackViewProfile.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor), |
100 | | - stackViewProfile.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor), |
101 | | - stackViewProfile.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor, constant: -16), |
102 | | - |
103 | 88 | profileImage.heightAnchor.constraint(equalToConstant: 80), |
104 | 89 | profileImage.widthAnchor.constraint(equalToConstant: 80), |
105 | 90 | ]) |
106 | 91 | } |
107 | 92 |
|
108 | | - |
| 93 | + func applyAdditionalChanges() { |
| 94 | + translatesAutoresizingMaskIntoConstraints = false |
| 95 | + axis = .vertical |
| 96 | + spacing = 8 |
| 97 | + alignment = .center |
| 98 | + } |
109 | 99 | } |
0 commit comments