Skip to content

Commit

Permalink
fix/#357 약속 참여 인원 1명일 때 참여자 뜨지 않는 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
youz2me committed Sep 4, 2024
1 parent 70839ce commit 1495e46
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ParticipantCollectionViewCell: BaseCollectionViewCell {
let profileImageView: UIImageView = UIImageView().then {
$0.backgroundColor = .gray1
$0.image = .imgProfile
$0.contentMode = .scaleAspectFit
$0.contentMode = .scaleAspectFill
$0.layer.cornerRadius = Screen.height(64) / 2
$0.clipsToBounds = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class PromiseInfoView: BaseView {
frame: .zero,
collectionViewLayout: UICollectionViewFlowLayout().then {
$0.scrollDirection = .horizontal
$0.minimumInteritemSpacing = 12
$0.estimatedItemSize = .init(width: Screen.width(68), height: Screen.height(88))
}).then {
$0.backgroundColor = .clear
$0.showsHorizontalScrollIndicator = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ extension PromiseInfoViewController {
color: .gray3
)

self.rootView.participantCollectionView.layoutIfNeeded()
owner.rootView.participantCollectionView.reloadData()
}
}
Expand Down Expand Up @@ -180,21 +181,20 @@ extension PromiseInfoViewController: UICollectionViewDataSource {
_ collectionView: UICollectionView,
numberOfItemsInSection section: Int
) -> Int {
return (viewModel.participantsInfo.value?.count ?? 0)
guard let info = viewModel.participantsInfo.value else {
return 0
}

return info.count
}
}


// MARK: - UICollectionViewDelegateFlowLayout

extension PromiseInfoViewController: UICollectionViewDelegateFlowLayout {

func collectionView(
_ collectionView: UICollectionView,
cellForItemAt indexPath: IndexPath
) -> UICollectionViewCell {
guard let cell = collectionView.dequeueReusableCell(
withReuseIdentifier: ParticipantCollectionViewCell.reuseIdentifier,
for: indexPath) as? ParticipantCollectionViewCell
for: indexPath) as? ParticipantCollectionViewCell
else { return UICollectionViewCell() }

guard let info = viewModel.participantsInfo.value?[indexPath.row] else {
Expand All @@ -214,3 +214,13 @@ extension PromiseInfoViewController: UICollectionViewDelegateFlowLayout {
return cell
}
}


// MARK: - UICollectionViewDelegateFlowLayout

extension PromiseInfoViewController: UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: Screen.width(68), height: Screen.height(88))
}
}

0 comments on commit 1495e46

Please sign in to comment.