Skip to content

Commit

Permalink
chore: 하드코딩된 크기값과 제약조건값을 enum으로 관리
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteHyun committed Nov 16, 2023
1 parent 0de91f8 commit a494f6c
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,21 +146,24 @@ public final class WorkoutSummaryViewController: UIViewController {
let item = NSCollectionLayoutItem(
layoutSize: .init(
widthDimension: .fractionalWidth(1),
heightDimension: .absolute(84)
heightDimension: .absolute(Metrics.collectionViewCellHeight)
)
)
item.edgeSpacing = .init(leading: nil, top: .fixed(6), trailing: nil, bottom: .fixed(6))
item.edgeSpacing = .init(
leading: nil,
top: .fixed(Metrics.collectionViewItemSpacing),
trailing: nil,
bottom: .fixed(Metrics.collectionViewItemSpacing)
)

let group = NSCollectionLayoutGroup.vertical(
layoutSize: .init(
widthDimension: .fractionalWidth(1),
heightDimension: .estimated(468)
heightDimension: .estimated(468) // Item 높이와 수에 따라 정해지기에 의미없는 값(468)을 넣음
),
subitems: [item]
)

group.interItemSpacing = .fixed(12)

let section = NSCollectionLayoutSection(group: group)

return UICollectionViewCompositionalLayout(section: section)
Expand Down Expand Up @@ -204,9 +207,12 @@ private extension WorkoutSummaryViewController {
static let recordTimerLabelTop: CGFloat = 12
static let collectionViewTop: CGFloat = 12
static let collectionViewBottom: CGFloat = 44
static let collectionViewItemSpacing: CGFloat = 6
static let horizontal: CGFloat = 36
static let endingWorkoutButtonSize: CGFloat = 150
static let endingWorkoutButtonBottom: CGFloat = 32

static let endingWorkoutButtonSize: CGFloat = 150
static let collectionViewCellHeight: CGFloat = 84
}
}

Expand Down

0 comments on commit a494f6c

Please sign in to comment.