From 7598fed2b7ebf1e61d13626bbf9f0e1207fb7de7 Mon Sep 17 00:00:00 2001 From: yungu0010 Date: Mon, 16 Dec 2024 12:49:26 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20#459=20-=20=EC=9D=BC=EC=A0=95=20?= =?UTF-8?q?=EC=8A=A4=ED=81=AC=EB=A1=A4=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CalendarDetailScene/VC/HomeCalendarDetailVC.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/CalendarDetailScene/VC/HomeCalendarDetailVC.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/CalendarDetailScene/VC/HomeCalendarDetailVC.swift index 7fe0a745..0eec473a 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/CalendarDetailScene/VC/HomeCalendarDetailVC.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/CalendarDetailScene/VC/HomeCalendarDetailVC.swift @@ -70,6 +70,8 @@ final class HomeCalendarDetailVC: UIViewController, HomeCalendarDetailViewContro if let gradientLayer = gradationView.layer.sublayers?.first as? CAGradientLayer { gradientLayer.frame = gradationView.bounds } + + scrollToRecentSchedule() } } @@ -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 {