Skip to content

Commit

Permalink
[Feat] #459 - 일정 스크롤 기능 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
yungu0010 committed Dec 16, 2024
1 parent 42bf683 commit 7598fed
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ final class HomeCalendarDetailVC: UIViewController, HomeCalendarDetailViewContro
if let gradientLayer = gradationView.layer.sublayers?.first as? CAGradientLayer {
gradientLayer.frame = gradationView.bounds
}

scrollToRecentSchedule()
}
}

Expand Down Expand Up @@ -114,6 +116,15 @@ extension HomeCalendarDetailVC {
private func registerCells() {
collectionView.register(HomeCalendarDetailCVC.self, forCellWithReuseIdentifier: HomeCalendarDetailCVC.className)
}

@MainActor
private func scrollToRecentSchedule() {
if let index = self.viewModel.calendarDetailList.firstIndex(where: {$0.isRecentSchedule}) {
self.collectionView.scrollToItem(at: IndexPath(item: index, section: 0),
at: .top,
animated: true)
}
}
}

extension HomeCalendarDetailVC: UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
Expand Down

0 comments on commit 7598fed

Please sign in to comment.