Skip to content

Commit

Permalink
[Feat] Keyneez#46 - 저장탭 데이터 바인딩
Browse files Browse the repository at this point in the history
  • Loading branch information
kpk0616 committed Jan 13, 2023
1 parent 6ff3128 commit 929d0ba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions Keyneez/Keyneez/Tab/Home/Views/HomeSearchCollectionViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,15 @@ extension HomeSearchCollectionViewCell {
}
func bindHomeSearchData(model: SearchContentResponseDto) {
titleLabel.text = model.contentTitle
dateLabel.text = setDateLabel(model: model)
dateLabel.text = setDateLabel(startAt: model.startAt, endAt: model.endAt)
guard let url = URL(string: model.contentImg ?? "") else { return }
// TODO: 이미지, 버튼 값 변경
}
func bindLikedContentData(model: MyLikedContentResponseDto) {
titleLabel.text = model.contentTitle
dateLabel.text = setDateLabel(startAt: model.startAt, endAt: model.endAt)
likeButton.isHidden = true
guard let url = URL(string: model.contentImg ?? "") else { return }
backgroundImageView.kf.setImage(with: url)
// backgroundImageView.load(url: URL(string: model.contentImg!)!)
// TODO: 이미지, 버튼 값 변경
}
@objc
Expand All @@ -77,9 +82,9 @@ extension HomeSearchCollectionViewCell {
let day = (fullDate[dayIndex...])
return month + "." + day
}
private func setDateLabel(model: SearchContentResponseDto) -> String {
if model.startAt == nil || model.endAt == nil { return "2023 ~ " }
if model.startAt!.isEmpty || model.endAt!.isEmpty { return "2023 ~ " }
return getDate(fullDate: model.startAt!) + " ~ " + getDate(fullDate: model.endAt!)
private func setDateLabel(startAt: String?, endAt: String?) -> String {
if startAt == nil || endAt == nil { return "2023 ~ " }
if startAt!.isEmpty || endAt!.isEmpty { return "2023 ~ " }
return getDate(fullDate: startAt!) + " ~ " + getDate(fullDate: endAt!)
}
}
2 changes: 1 addition & 1 deletion Keyneez/Keyneez/Tab/Like/LikeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ extension LikeViewController: UICollectionViewDataSource {
guard let likedContentCell = collectionView.dequeueReusableCell(
withReuseIdentifier: HomeSearchCollectionViewCell.identifier, for: indexPath)
as? HomeSearchCollectionViewCell else { return UICollectionViewCell() }
// homeSearchCell.bindHomeSearchData(model: homeSearchList[indexPath.item])
likedContentCell.bindLikedContentData(model: likedContentDataSource[indexPath.item])
return likedContentCell
}
}

0 comments on commit 929d0ba

Please sign in to comment.