Skip to content

Commit

Permalink
[Feat/#19] Challenge - AppModel 사용
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoe0929 committed Jan 6, 2024
1 parent 3fd4e78 commit bd4cb26
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions HMH_iOS/HMH_iOS/Presentation/Challenge/Views/ChallengeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ final class ChallengeView: UIView {

private let goalTime: Int = 3
private var days: Int = 14
private let AppList: [AppModel] = []
private let appList: [AppModel] = [AppModel(appIcon: "", appName: "Instagram", appUseTime: "1시간 20분"),
AppModel(appIcon: "", appName: "Youtube", appUseTime: "1시간")]

lazy var challengeCollectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()).then {
$0.backgroundColor = .background
Expand Down Expand Up @@ -78,7 +79,7 @@ extension ChallengeView: UICollectionViewDataSource {
case 0:
return days
case 1:
return 3
return appList.count
default:
return 0
}
Expand All @@ -98,7 +99,11 @@ extension ChallengeView: UICollectionViewDataSource {
cell.configureCell(date: "\(1 + indexPath.item)")
return cell
case 1:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: AppListCollectionViewCell.identifer, for: indexPath)
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: AppListCollectionViewCell.identifer, for: indexPath)
as? AppListCollectionViewCell else {
return UICollectionViewCell()
}
cell.configureCell(appName: appList[indexPath.item].appName, appTime: appList[indexPath.item].appUseTime)
return cell
default:
return UICollectionViewCell()
Expand Down

0 comments on commit bd4cb26

Please sign in to comment.