diff --git a/SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift b/SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift index 5b4b4ac0..c21ebb15 100644 --- a/SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift +++ b/SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift @@ -287,9 +287,15 @@ public struct I18N { public static let instagram = "인스타" public static let youtube = "유튜브" } + + public struct CalendarDetail { + public static let navigationTitle = "일정" + public static let attendance = "출석하러 가기" + } } public struct Soptlog { + public static let navigationTitle = "솝트로그" public static let editProfile = "프로필 수정" public static let enrollIntroduce = "프로필 수정에서 한 줄 소개 등록해보세요!" } diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Interface/Sources/HomeCalendarDetailPresentable.swift b/SOPT-iOS/Projects/Features/HomeFeature/Interface/Sources/HomeCalendarDetailPresentable.swift new file mode 100644 index 00000000..b3a329c7 --- /dev/null +++ b/SOPT-iOS/Projects/Features/HomeFeature/Interface/Sources/HomeCalendarDetailPresentable.swift @@ -0,0 +1,19 @@ +// +// HomeCalendarDetailPresentable.swift +// HomeFeatureDemo +// +// Created by 강윤서 on 12/12/24. +// Copyright © 2024 SOPT-iOS. All rights reserved. +// + +import Foundation + +import BaseFeatureDependency +import Core + +public protocol HomeCalendarDetailViewControllable: ViewControllable {} +public protocol HomeCalendarDetailCoordinatable { + +} +public typealias HomeCalendarDetailViewModelType = ViewModelType & HomeCalendarDetailCoordinatable +public typealias HomeCalendarDetailPresentable = (vc: HomeCalendarDetailViewControllable, vm: any HomeCalendarDetailViewModelType) diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Interface/Sources/HomeFeatureBuildable.swift b/SOPT-iOS/Projects/Features/HomeFeature/Interface/Sources/HomeFeatureBuildable.swift index 553ec320..486b04cc 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Interface/Sources/HomeFeatureBuildable.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Interface/Sources/HomeFeatureBuildable.swift @@ -11,4 +11,5 @@ import Core public protocol HomeFeatureBuildable { func makeHomeForMember() -> HomeForMemberPresentable func makeHomeForVisitor() -> HomeForVisitorPresentable + func makeHomeCalendarDetail() -> HomeCalendarDetailPresentable } diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Interface/Sources/HomeForMemberPresentable.swift b/SOPT-iOS/Projects/Features/HomeFeature/Interface/Sources/HomeForMemberPresentable.swift index dacb95d2..3d55e753 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Interface/Sources/HomeForMemberPresentable.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Interface/Sources/HomeForMemberPresentable.swift @@ -13,6 +13,7 @@ import Core public protocol HomeForMemberViewControllable: ViewControllable { } public protocol HomeForMemberCoordinatable { + var onDashBoardCellTapped: (() -> Void)? { get set } } public typealias HomeForMemberViewModelType = ViewModelType & HomeForMemberCoordinatable diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/CalendarDetailScene/Cells/HomeCalendarDetailCVC.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/CalendarDetailScene/Cells/HomeCalendarDetailCVC.swift new file mode 100644 index 00000000..0bb03b3f --- /dev/null +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/CalendarDetailScene/Cells/HomeCalendarDetailCVC.swift @@ -0,0 +1,102 @@ +// +// HomeCalendarDetailCVC.swift +// HomeFeatureDemo +// +// Created by 강윤서 on 12/12/24. +// Copyright © 2024 SOPT-iOS. All rights reserved. +// + +import UIKit + +import Then +import DSKit + +final class HomeCalendarDetailCVC: UICollectionViewCell { + + // MARK: UI Components + + private let circleView = UIView().then { + $0.backgroundColor = DSKitAsset.Colors.gray500.color + $0.layer.cornerRadius = 7.5 + } + + private let stickView = UIView().then { + $0.backgroundColor = DSKitAsset.Colors.gray500.color + } + + private let dateLabel = UILabel().then { + $0.font = DSKitFontFamily.Suit.medium.font(size: 14) + $0.textColor = DSKitAsset.Colors.gray300.color + } + + private let homeCategoryTagView = HomeSquareTagView() + + private let calendarTitleLabel = UILabel().then { + $0.font = DSKitFontFamily.Suit.bold.font(size: 18) + $0.textColor = DSKitAsset.Colors.gray10.color + } + + // MARK: - Initialization + + override init(frame: CGRect) { + super.init(frame: frame) + + setUI() + setLayout() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: UI & Layout + +extension HomeCalendarDetailCVC { + private func setUI() { + contentView.backgroundColor = .clear + } + + private func setLayout() { + contentView.addSubviews(circleView, stickView, dateLabel, homeCategoryTagView, calendarTitleLabel) + + circleView.snp.makeConstraints { make in + make.width.height.equalTo(13) + make.top.equalToSuperview().inset(15) + make.leading.equalToSuperview().inset(1.5) + } + + stickView.snp.makeConstraints { make in + make.top.equalTo(circleView.snp.bottom) + make.centerX.equalTo(circleView) + make.width.equalTo(1) + make.bottom.equalToSuperview().offset(90) + } + + dateLabel.snp.makeConstraints { make in + make.leading.equalTo(circleView.snp.trailing).offset(9.5) + make.centerY.equalTo(circleView) + } + + homeCategoryTagView.snp.makeConstraints { make in + make.top.equalTo(dateLabel.snp.bottom).offset(17) + make.leading.equalTo(dateLabel) + } + + calendarTitleLabel.snp.makeConstraints { make in + make.centerY.equalTo(homeCategoryTagView) + make.leading.equalTo(homeCategoryTagView.snp.trailing).offset(10) + } + } +} + +extension HomeCalendarDetailCVC { + func configureCell(_ model: CalendarDetail) { + dateLabel.text = model.date + calendarTitleLabel.text = model.title + homeCategoryTagView.setData(title: model.type.text, + titleColor: model.type.textColor, + backgroundColor: model.type.backgroundColor) + circleView.backgroundColor = model.isRecentSchedule ? DSKitAsset.Colors.white.color : DSKitAsset.Colors.gray500.color + } +} diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/CalendarDetailScene/VC/HomeCalendarDetailVC.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/CalendarDetailScene/VC/HomeCalendarDetailVC.swift new file mode 100644 index 00000000..47335798 --- /dev/null +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/CalendarDetailScene/VC/HomeCalendarDetailVC.swift @@ -0,0 +1,160 @@ +// +// HomeCalendarDetailVC.swift +// HomeFeatureDemo +// +// Created by 강윤서 on 12/12/24. +// Copyright © 2024 SOPT-iOS. All rights reserved. +// + +import UIKit +import DSKit +import Core + +final class HomeCalendarDetailVC: UIViewController, HomeCalendarDetailViewControllable { + + // MARK: Properties + + public let viewModel: HomeCalendarDetailViewModel + + // MARK: UI Components + + private lazy var naviBar = OPNavigationBar(self, + type: .oneLeftButton, + backgroundColor: DSKitAsset.Colors.semanticBackground.color) + .addMiddleLabel(title: I18N.Home.CalendarDetail.navigationTitle, font: DSKitFontFamily.Suit.medium.font(size: 16)) + + + private lazy var collectionView = UICollectionView( + frame: .zero, + collectionViewLayout: UICollectionViewFlowLayout() + ).then { + $0.isScrollEnabled = true + $0.showsHorizontalScrollIndicator = false + $0.showsVerticalScrollIndicator = false + $0.contentInset = UIEdgeInsets(top: 16, left: 0, bottom: 138, right: 0) + $0.backgroundColor = .clear + } + + private let attendanceButton = AppCustomButton(title: I18N.Home.CalendarDetail.attendance) + .changeCornerRadius(radius: 12) + .setConfigForState(enabledFont: DSKitFontFamily.Suit.semiBold.font(size: 18)) + + private let gradientView = UIView().then { + let gradientLayer = CAGradientLayer() + gradientLayer.colors = [DSKitAsset.Colors.black.color.withAlphaComponent(0.0).cgColor, DSKitAsset.Colors.black.color.cgColor] + gradientLayer.startPoint = CGPoint(x: 0.5, y: 0) + gradientLayer.endPoint = CGPoint(x: 0.5, y: 1) + $0.layer.addSublayer(gradientLayer) + $0.isUserInteractionEnabled = false + } + + // MARK: - Initialization + + init(viewModel: HomeCalendarDetailViewModel) { + self.viewModel = viewModel + super.init(nibName: nil, bundle: nil) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - Life Cycle + + override func viewDidLoad() { + super.viewDidLoad() + + setUI() + setLayout() + setDelegate() + registerCells() + } + + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + + if let gradientLayer = gradientView.layer.sublayers?.first as? CAGradientLayer { + gradientLayer.frame = gradientView.bounds + } + + scrollToRecentSchedule() + } +} + +// MARK: - UI & Layout + +extension HomeCalendarDetailVC { + private func setUI() { + view.backgroundColor = DSKitAsset.Colors.semanticBackground.color + self.navigationController?.isNavigationBarHidden = true + } + + private func setLayout() { + view.addSubviews(naviBar, collectionView, gradientView, attendanceButton) + + naviBar.snp.makeConstraints { make in + make.top.leading.trailing.equalTo(view.safeAreaLayoutGuide) + } + + collectionView.snp.makeConstraints { make in + make.top.equalTo(naviBar.snp.bottom) + make.leading.trailing.equalToSuperview().inset(20) + make.bottom.equalToSuperview() + } + + gradientView.snp.makeConstraints { make in + make.leading.trailing.bottom.equalToSuperview() + make.height.equalTo(209.adjustedH) + } + + attendanceButton.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(20) + make.bottom.equalToSuperview().inset(34) + make.height.equalTo(56) + } + } +} + +// MARK: - Methods + +extension HomeCalendarDetailVC { + private func setDelegate() { + collectionView.dataSource = self + collectionView.delegate = self + } + + private func registerCells() { + collectionView.register(HomeCalendarDetailCVC.self, forCellWithReuseIdentifier: HomeCalendarDetailCVC.className) + } + + 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 { + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return viewModel.calendarDetailList.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: HomeCalendarDetailCVC.className, for: indexPath) as? HomeCalendarDetailCVC else { return UICollectionViewCell() } + + cell.configureCell(viewModel.calendarDetailList[indexPath.row]) + + return cell + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + let length = self.collectionView.frame.size.width + return CGSize(width: length, height: 96.adjustedH) + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return 0 + } +} diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/CalendarDetailScene/ViewModel/HomeCalendarDetailViewModel.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/CalendarDetailScene/ViewModel/HomeCalendarDetailViewModel.swift new file mode 100644 index 00000000..5e0b42c5 --- /dev/null +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/CalendarDetailScene/ViewModel/HomeCalendarDetailViewModel.swift @@ -0,0 +1,56 @@ +// +// HomeCalendarDetailViewModel.swift +// HomeFeatureDemo +// +// Created by 강윤서 on 12/12/24. +// Copyright © 2024 SOPT-iOS. All rights reserved. +// + +import Foundation + +import Core +import HomeFeatureInterface + +struct CalendarDetail { + let date: String + let title: String + let isRecentSchedule: Bool + let type: DashBoardCalenderCategoryTagType +} + + +public class HomeCalendarDetailViewModel: HomeCalendarDetailViewModelType { + + // TODO: - 서버 연결 필요 + + let calendarDetailList: [CalendarDetail] = [ + CalendarDetail(date: "9월 28일 토요일", title: "OT", isRecentSchedule: false, type: .event), + CalendarDetail(date: "9월 28일 토요일", title: "1차 세미나", isRecentSchedule: false, type: .seminar), + CalendarDetail(date: "9월 28일 토요일", title: "2차 세미나", isRecentSchedule: false, type: .seminar), + CalendarDetail(date: "9월 28일 토요일", title: "3차 세미나", isRecentSchedule: true, type: .seminar), + CalendarDetail(date: "9월 28일 토요일", title: "4차 세미나", isRecentSchedule: false, type: .seminar), + CalendarDetail(date: "9월 28일 토요일", title: "5차 세미나", isRecentSchedule: false, type: .seminar), + CalendarDetail(date: "9월 28일 토요일", title: "6차 세미나", isRecentSchedule: false, type: .seminar), + CalendarDetail(date: "9월 28일 토요일", title: "7차 세미나", isRecentSchedule: false, type: .seminar), + CalendarDetail(date: "9월 28일 토요일", title: "8차 세미나", isRecentSchedule: false, type: .seminar) + ] + + // MARK: - Inputs + + public struct Input { } + + // MARK: - Outputs + + public struct Output { } + + // MARK: - initialization + + public init() { } +} + +extension HomeCalendarDetailViewModel { + public func transform(from input: Input, cancelBag: CancelBag) -> Output { + let output = Output() + return output + } +} diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Components/TagTypes/DashBoardCalenderCategoryTagType.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Components/TagTypes/DashBoardCalenderCategoryTagType.swift index dc4c5bc5..c12bdf56 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Components/TagTypes/DashBoardCalenderCategoryTagType.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Components/TagTypes/DashBoardCalenderCategoryTagType.swift @@ -29,7 +29,7 @@ enum DashBoardCalenderCategoryTagType: String { case .event: return DSKitAsset.Colors.success.color case .seminar: - return DSKitAsset.Colors.success.color + return DSKitAsset.Colors.secondary.color } } diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Coordinator/HomeBuilder.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Coordinator/HomeBuilder.swift index c6e8ce0d..1b4a9617 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Coordinator/HomeBuilder.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Coordinator/HomeBuilder.swift @@ -31,4 +31,10 @@ extension HomeBuilder: HomeFeatureBuildable { let homeForVisitorVC = HomeForVisitorVC(viewModel: viewModel) return (homeForVisitorVC, viewModel) } + + public func makeHomeCalendarDetail() -> HomeCalendarDetailPresentable { + let viewModel = HomeCalendarDetailViewModel() + let homeCalendarDetailVC = HomeCalendarDetailVC(viewModel: viewModel) + return (homeCalendarDetailVC, viewModel) + } } diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Coordinator/HomeCoordinator.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Coordinator/HomeCoordinator.swift index daeb0d6a..721924f2 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Coordinator/HomeCoordinator.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Coordinator/HomeCoordinator.swift @@ -45,6 +45,11 @@ public final class HomeCoordinator: DefaultCoordinator { public func showHomeForMember() { var homeForMember = factory.makeHomeForMember() + + homeForMember.vm.onDashBoardCellTapped = { [weak self] in + let homeCalendarDetail = self?.factory.makeHomeCalendarDetail() + self?.router.push(homeCalendarDetail?.vc) + } router.replaceRootWindow(homeForMember.vc, withAnimation: true) } diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForMemberVC.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForMemberVC.swift index 09bd1821..bda555b6 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForMemberVC.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForMemberVC.swift @@ -57,6 +57,7 @@ final class HomeForMemberVC: UIViewController, HomeForMemberViewControllable { setLayout() setDelegate() registerCells() + bindViewModels() } } @@ -137,6 +138,14 @@ extension HomeForMemberVC { self.collectionView.register(SocialLinkCardCVC.self, forCellWithReuseIdentifier: SocialLinkCardCVC.className) } + + private func bindViewModels() { + let input = HomeForMemberViewModel.Input( + cellTapped: cellTapped.asDriver() + ) + + let output = self.viewModel.transform(from: input, cancelBag: self.cancelBag) + } } // MARK: - UICollectionViewDelegate @@ -148,11 +157,15 @@ extension HomeForMemberVC: UICollectionViewDelegate { // MARK: - UICollectionViewDataSource extension HomeForMemberVC: UICollectionViewDataSource { - public func numberOfSections(in collectionView: UICollectionView) -> Int { + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + cellTapped.send(indexPath) + } + + func numberOfSections(in collectionView: UICollectionView) -> Int { return HomeForMemberSectionLayoutKind.allCases.count } - public func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { + func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { guard let sectionKind = HomeForMemberSectionLayoutKind(rawValue: indexPath.section) else { return UICollectionReusableView() } /// Header View @@ -181,7 +194,7 @@ extension HomeForMemberVC: UICollectionViewDataSource { return UICollectionReusableView() } - public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { guard let sectionKind = HomeForMemberSectionLayoutKind(rawValue: section) else { return 0 } switch sectionKind { @@ -197,7 +210,7 @@ extension HomeForMemberVC: UICollectionViewDataSource { } } - public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let sectionKind = HomeForMemberSectionLayoutKind(rawValue: indexPath.section) else { return UICollectionViewCell() } switch sectionKind { diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/ViewModel/HomeForMemberViewModel.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/ViewModel/HomeForMemberViewModel.swift index 4238bc8e..2c2745be 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/ViewModel/HomeForMemberViewModel.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/ViewModel/HomeForMemberViewModel.swift @@ -141,6 +141,11 @@ public class HomeForMemberViewModel: HomeForMemberViewModelType { let needToReload = PassthroughSubject() } + // MARK: - HomeForeMemberCoordinating + + public var onDashBoardCellTapped: (() -> Void)? + + // MARK: - initialization public init(useCase: HomeUseCase) { @@ -149,7 +154,7 @@ public class HomeForMemberViewModel: HomeForMemberViewModelType { } extension HomeForMemberViewModel { - public func transform(from input: Input, cancelBag: Core.CancelBag) -> Output { + public func transform(from input: Input, cancelBag: CancelBag) -> Output { let output = Output() self.bindOutput(output: output, cancelBag: cancelBag) diff --git a/SOPT-iOS/Projects/Features/RootFeature/Sources/ApplicationCoordinator.swift b/SOPT-iOS/Projects/Features/RootFeature/Sources/ApplicationCoordinator.swift index 7e39e4aa..ac5bc33c 100644 --- a/SOPT-iOS/Projects/Features/RootFeature/Sources/ApplicationCoordinator.swift +++ b/SOPT-iOS/Projects/Features/RootFeature/Sources/ApplicationCoordinator.swift @@ -13,6 +13,7 @@ import BaseFeatureDependency import SplashFeature import AuthFeature import MainFeature +import HomeFeature import AppMyPageFeature import NotificationFeature import StampFeature @@ -196,6 +197,19 @@ extension ApplicationCoordinator { coordinator.start() } + internal func runHomeFlow(type: UserType) { + let coordinator = HomeCoordinator( + router: router, + factory: HomeBuilder(), + userType: type + ) + coordinator.finishFlow = { [weak self, weak coordinator] in + self?.removeDependency(coordinator) + } + addDependency(coordinator) + coordinator.start() + } + @discardableResult internal func runAttendanceFlow() -> AttendanceCoordinator { let coordinator = AttendanceCoordinator( diff --git a/SOPT-iOS/Projects/Features/SoptlogFeature/Sources/SoptlogScene/CollectionView/SoptlogCompositinalLayout.swift b/SOPT-iOS/Projects/Features/SoptlogFeature/Sources/SoptlogScene/CollectionView/SoptlogCompositinalLayout.swift index 44874c6b..56e5dc57 100644 --- a/SOPT-iOS/Projects/Features/SoptlogFeature/Sources/SoptlogScene/CollectionView/SoptlogCompositinalLayout.swift +++ b/SOPT-iOS/Projects/Features/SoptlogFeature/Sources/SoptlogScene/CollectionView/SoptlogCompositinalLayout.swift @@ -54,15 +54,7 @@ extension SoptlogVC { subitems: [introduceItem]) /// section 지정 - let section = NSCollectionLayoutSection( - group: NSCollectionLayoutGroup.vertical( - layoutSize: NSCollectionLayoutSize( - widthDimension: .fractionalWidth(1.0), - heightDimension: .estimated(80) - ), - subitems: [introduceGroup] - ) - ) + let section = NSCollectionLayoutSection(group: introduceGroup) section.boundarySupplementaryItems = [header] section.contentInsets = NSDirectionalEdgeInsets(top: 16, leading: Metric.collectionViewDefaultSideInset, @@ -86,15 +78,7 @@ extension SoptlogVC { productGroup.interItemSpacing = .fixed(Metric.productItemSpacing) /// section 지정 - let section = NSCollectionLayoutSection( - group: NSCollectionLayoutGroup.vertical( - layoutSize: NSCollectionLayoutSize( - widthDimension: .fractionalWidth(1.0), - heightDimension: .estimated(126) - ), - subitems: [productGroup] - ) - ) + let section = NSCollectionLayoutSection(group: productGroup) let backgroundItem = NSCollectionLayoutDecorationItem.background( elementKind: AppServiceSectionBackgroundView.className) backgroundItem.contentInsets = NSDirectionalEdgeInsets(top: Metric.defaultGroupSpacing, @@ -123,15 +107,7 @@ extension SoptlogVC { subitems: [editProfileItem]) /// section 지정 - let section = NSCollectionLayoutSection( - group: NSCollectionLayoutGroup.vertical( - layoutSize: NSCollectionLayoutSize( - widthDimension: .fractionalWidth(1.0), - heightDimension: .estimated(36) - ), - subitems: [editProfileGroup] - ) - ) + let section = NSCollectionLayoutSection(group: editProfileGroup) section.contentInsets = NSDirectionalEdgeInsets(top: 20, leading: Metric.collectionViewDefaultSideInset, bottom: 0, @@ -153,15 +129,7 @@ extension SoptlogVC { subitems: [alarmItem]) /// section 지정 - let section = NSCollectionLayoutSection( - group: NSCollectionLayoutGroup.vertical( - layoutSize: NSCollectionLayoutSize( - widthDimension: .fractionalWidth(1.0), - heightDimension: .estimated(295) - ), - subitems: [alarmGroup] - ) - ) + let section = NSCollectionLayoutSection(group: alarmGroup) section.contentInsets = NSDirectionalEdgeInsets(top: 40, leading: 0, bottom: 0, diff --git a/SOPT-iOS/Projects/Features/SoptlogFeature/Sources/SoptlogScene/VC/SoptlogVC.swift b/SOPT-iOS/Projects/Features/SoptlogFeature/Sources/SoptlogScene/VC/SoptlogVC.swift index 455653fc..a2f24e0b 100644 --- a/SOPT-iOS/Projects/Features/SoptlogFeature/Sources/SoptlogScene/VC/SoptlogVC.swift +++ b/SOPT-iOS/Projects/Features/SoptlogFeature/Sources/SoptlogScene/VC/SoptlogVC.swift @@ -22,6 +22,9 @@ final class SoptlogVC: UIViewController, SoptlogViewControllable { // MARK: - UI Components + private lazy var naviBar = OPNavigationBar(self, type: .oneLeftButton) + .addMiddleLabel(title: I18N.Soptlog.navigationTitle, font: DSKitFontFamily.Suit.medium.font(size: 16)) + private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: self.createLayout()).then { $0.isScrollEnabled = true $0.showsHorizontalScrollIndicator = false @@ -61,10 +64,14 @@ extension SoptlogVC { } private func setLayout() { - view.addSubviews(collectionView) + view.addSubviews(naviBar, collectionView) + + naviBar.snp.makeConstraints { make in + make.top.leading.trailing.equalTo(view.safeAreaLayoutGuide) + } collectionView.snp.makeConstraints { make in - make.top.equalTo(view.safeAreaLayoutGuide).offset(16) + make.top.equalTo(naviBar.snp.bottom).offset(16) make.leading.trailing.bottom.equalTo(view.safeAreaLayoutGuide) } }