Skip to content

Commit 1a760ca

Browse files
committed
Fix: Metric 적용
1 parent 52d89ea commit 1a760ca

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

HomeCafeRecipes/HomeCafeRecipes/Presentation/FeedList/View/RecipeListView.swift

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,31 @@ import UIKit
99

1010
final class RecipeListView: UIView {
1111

12-
private let itemSize = CGSize(width: UIScreen.main.bounds.width - 20, height: 200)
12+
private enum Metric {
13+
static let itemSize: CGSize = .init(width: UIScreen.main.bounds.width - 20, height: 200)
14+
static let minimumLineSpacing: CGFloat = 10.0
15+
static let minimumInteritemSpacing: CGFloat = 10.0
16+
17+
}
1318
private let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout())
14-
19+
1520
override init(frame: CGRect) {
1621
super.init(frame: frame)
1722
setupUI()
1823
setupLayout()
1924
}
20-
25+
2126
required init?(coder: NSCoder) {
2227
fatalError("init(coder:) has not been implemented")
2328
}
24-
29+
2530
private func setupUI() {
2631
backgroundColor = .white
2732
addSubview(collectionView)
2833
collectionView.register(RecipeListViewCell.self, forCellWithReuseIdentifier: "RecipeCell")
2934
configureCollectionView()
3035
}
31-
36+
3237
private func setupLayout() {
3338
collectionView.translatesAutoresizingMaskIntoConstraints = false
3439
NSLayoutConstraint.activate([
@@ -38,12 +43,12 @@ final class RecipeListView: UIView {
3843
collectionView.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor)
3944
])
4045
}
41-
46+
4247
private func configureCollectionView() {
4348
let layout = UICollectionViewFlowLayout()
44-
layout.itemSize = itemSize
45-
layout.minimumLineSpacing = 10
46-
layout.minimumInteritemSpacing = 10
49+
layout.itemSize = Metric.itemSize
50+
layout.minimumLineSpacing = Metric.minimumLineSpacing
51+
layout.minimumInteritemSpacing = Metric.minimumInteritemSpacing
4752
collectionView.collectionViewLayout = layout
4853
}
4954

0 commit comments

Comments
 (0)