Skip to content

Commit

Permalink
[Fix] #196 - bottomSeparator 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongdung-eo committed Jan 27, 2024
1 parent d91a373 commit 053b859
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ final class DetailAchievementViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

setUI()
setLayout()
setDataSource()
Expand All @@ -69,10 +69,10 @@ final class DetailAchievementViewController: UIViewController {
// MARK: - Methods

extension DetailAchievementViewController {

private func setUI() {
view.backgroundColor = .black.withAlphaComponent(0.6)

collectionView.do {
$0.collectionViewLayout = layout()
$0.layer.cornerRadius = 15
Expand All @@ -81,10 +81,10 @@ extension DetailAchievementViewController {
$0.autoresizingMask = [.flexibleWidth, .flexibleHeight]
}
}

private func setLayout() {
view.addSubview(collectionView)

collectionView.snp.makeConstraints {
$0.center.equalTo(safeArea)
$0.directionalHorizontalEdges.equalTo(safeArea).inset(15)
Expand Down Expand Up @@ -149,6 +149,13 @@ extension DetailAchievementViewController {
leading: 20,
bottom: 0,
trailing: 20)
config.itemSeparatorHandler = { indexPath, config in
var config = config
guard let itemCount = self.dataSource?.snapshot().itemIdentifiers(inSection: .main).count else { return config }
let isLastItem = indexPath.item == itemCount - 1
config.bottomSeparatorVisibility = isLastItem ? .hidden : .visible
return config
}

return UICollectionViewCompositionalLayout.list(using: config)
}
Expand Down

0 comments on commit 053b859

Please sign in to comment.