-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3fe999
commit 5184982
Showing
4 changed files
with
50 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
Tving_CloneProject/Tving_CloneProject/Scene/Main/ViewModel/PageControlButtonViewModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// PageControlButtonViewModel.swift | ||
// Tving_CloneProject | ||
// | ||
// Created by 윤희슬 on 5/31/24. | ||
// | ||
|
||
import UIKit | ||
|
||
final class PageControlButtonViewModel: NSObject { | ||
var buttonCount: ObservablePattern<Int> = ObservablePattern.init(0) | ||
} | ||
|
||
extension PageControlButtonViewModel: UICollectionViewDataSource { | ||
|
||
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { | ||
guard let count = buttonCount.value else { return 0 } | ||
return count | ||
} | ||
|
||
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { | ||
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: PagerButtonCell.identifier, for: indexPath) as? PagerButtonCell | ||
else { return UICollectionViewCell() } | ||
|
||
cell.pagerButton.tag = indexPath.row | ||
|
||
return cell | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters