From 64dcf56ed2f6b0553a2bab667b4b313eabd8e793 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Mon, 9 Dec 2024 00:28:34 +0900 Subject: [PATCH 01/12] =?UTF-8?q?[Add]=20#461=20-=20=EB=B0=A9=EB=AC=B8?= =?UTF-8?q?=EC=9E=90=20=ED=99=88=EB=B7=B0=20=EA=B4=80=EB=A0=A8=20StringLit?= =?UTF-8?q?erals=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift b/SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift index c94b4159..5dee6ede 100644 --- a/SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift +++ b/SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift @@ -250,6 +250,9 @@ public struct I18N { public static let groupAndStudy = "모임/스터디" public static let member = "멤버" public static let project = "프로젝트" + public static let homePage = "홈페이지" + public static let activityReview = "활동후기" + public static let instagram = "인스타그램" } public struct AppService { From 6a0eb606457d5e4e2375b342333f26d656c6e281 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Mon, 9 Dec 2024 01:00:09 +0900 Subject: [PATCH 02/12] =?UTF-8?q?[Feat]=20#461=20-=20=EB=B0=A9=EB=AC=B8?= =?UTF-8?q?=EC=9E=90=20=ED=99=88=20=EC=BD=9C=EB=A0=89=EC=85=98=EB=B7=B0=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EC=84=B8=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeForVisitorCompositionalLayout.swift | 74 +++++++++++++++++++ .../HomeForVisitorSectionLayoutKind.swift | 26 +++++++ .../HomeScene/Coordinator/HomeBuilder.swift | 2 +- .../HomeScene/VC/HomeForVisitorVC.swift | 64 +++++++++++++++- 4 files changed, 164 insertions(+), 2 deletions(-) create mode 100644 SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift create mode 100644 SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorSectionLayoutKind.swift diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift new file mode 100644 index 00000000..b1600d96 --- /dev/null +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift @@ -0,0 +1,74 @@ +// +// HomeForVisitorCompositionalLayout.swift +// HomeFeature +// +// Created by Jae Hyun Lee on 12/9/24. +// Copyright © 2024 SOPT-iOS. All rights reserved. +// + +import UIKit + +import Core + +extension HomeForVisitorVC { + private enum Metric { + static let collectionViewDefaultSideInset: Double = 20 + static let defaultItemSpacing: Double = 16 + static let defaultGroupSpacing: Double = 12 + static let defaultLineSpacing: Double = 56 + + static let productItemSpacing: Double = 15 + static let appServiceItemSpacing: Double = 16 + } + + func createLayout() -> UICollectionViewCompositionalLayout { + return UICollectionViewCompositionalLayout { sectionIndex, env in + guard let sectionKind = HomeForVisitorSectionLayoutKind(rawValue: sectionIndex) else { return self.createEmptySection() } + + switch sectionKind { + case .dashBoard: + return self.createDashBoardSection() + default: + return self.createEmptySection() + } + } + } + + private func createDashBoardSection() -> NSCollectionLayoutSection { + /// header: 유저 정보 및 활동 히스토리 + let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), + heightDimension: .absolute(123)) + let header = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerSize, + elementKind: UICollectionView.elementKindSectionHeader, + alignment: .top) + + /// group 지정: 헤더만 존재 + let emptyGroupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), + heightDimension: .absolute(0)) + let emptyGroup = NSCollectionLayoutGroup.vertical(layoutSize: emptyGroupSize, + subitems: []) + + /// section 지정 + let section = NSCollectionLayoutSection(group: emptyGroup) + section.boundarySupplementaryItems = [header] + section.contentInsets = NSDirectionalEdgeInsets(top: 12, + leading: Metric.collectionViewDefaultSideInset, + bottom: 0, + trailing: Metric.collectionViewDefaultSideInset) + + return section + } + + private func createEmptySection() -> NSCollectionLayoutSection { + let itemSize = NSCollectionLayoutSize(widthDimension: .absolute(1), + heightDimension: .absolute(1)) + let item = NSCollectionLayoutItem(layoutSize: itemSize) + + let groupSize = NSCollectionLayoutSize(widthDimension: .absolute(1), + heightDimension: .absolute(1)) + let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, + subitems: [item]) + + return NSCollectionLayoutSection(group: group) + } +} diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorSectionLayoutKind.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorSectionLayoutKind.swift new file mode 100644 index 00000000..c4b7c644 --- /dev/null +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorSectionLayoutKind.swift @@ -0,0 +1,26 @@ +// +// HomeForVisitorSectionLayoutKind.swift +// HomeFeature +// +// Created by Jae Hyun Lee on 12/9/24. +// Copyright © 2024 SOPT-iOS. All rights reserved. +// + +import Foundation + +import Core + +enum HomeForVisitorSectionLayoutKind: Int, CaseIterable { + case dashBoard + case mainProduct + case appService + + var title: String { + switch self { + case .appService: + return I18N.Home.AppService.headerTitle + default: + return "" + } + } +} 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 48286587..44f535dc 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Coordinator/HomeBuilder.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Coordinator/HomeBuilder.swift @@ -22,8 +22,8 @@ extension HomeBuilder: HomeFeatureBuildable { } public func makeHomeForVisitor() -> HomeForVisitorPresentable { - let homeForVisitorVC = HomeForVisitorVC() let viewModel = HomeForVisitorViewModel() + let homeForVisitorVC = HomeForVisitorVC(viewModel: viewModel) return (homeForVisitorVC, viewModel) } } diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift index 4dbba128..49bda183 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift @@ -15,11 +15,37 @@ import DSKit import BaseFeatureDependency final class HomeForVisitorVC: UIViewController, HomeForVisitorViewControllable { + + // MARK: - Properties + + public let viewModel: HomeForVisitorViewModel // MARK: - UI Components private lazy var naviBar = HomeNavigationBar().hideNoticeButton() + private lazy var collectionView = UICollectionView( + frame: .zero, + collectionViewLayout: self.createLayout() + ).then { + $0.isScrollEnabled = true + $0.showsHorizontalScrollIndicator = false + $0.showsVerticalScrollIndicator = false + $0.contentInset = .zero + $0.backgroundColor = .clear + } + + // MARK: - Initialization + + public init(viewModel: HomeForVisitorViewModel) { + self.viewModel = viewModel + super.init(nibName: nil, bundle: nil) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + // MARK: - View Life Cycle override func viewDidLoad() { @@ -38,16 +64,52 @@ extension HomeForVisitorVC { } private func setLayout() { - view.addSubviews(naviBar) + view.addSubviews( + naviBar, + collectionView + ) naviBar.snp.makeConstraints { make in make.leading.top.trailing.equalTo(view.safeAreaLayoutGuide) } + + collectionView.snp.makeConstraints { make in + make.top.equalTo(naviBar.snp.bottom).offset(16) + make.leading.trailing.bottom.equalTo(view.safeAreaLayoutGuide) + } } } // MARK: - Methods extension HomeForVisitorVC { + private func setDelegate() { + self.collectionView.delegate = self + self.collectionView.dataSource = self + } + private func registerCells() { + + } +} + +// MARK: - UICollectionViewDelegate + +extension HomeForVisitorVC: UICollectionViewDelegate { + +} + +// MARK: - UICollectionViewDataSource + +extension HomeForVisitorVC: UICollectionViewDataSource { + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return HomeForVisitorSectionLayoutKind.allCases.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + guard let sectionKind = HomeForVisitorSectionLayoutKind(rawValue: indexPath.section) else { return UICollectionViewCell() } + switch sectionKind { + default: return UICollectionViewCell() + } + } } From d8725744d84754c2b4216b4d9bab0f8720ad6dec Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Mon, 9 Dec 2024 09:12:45 +0900 Subject: [PATCH 03/12] =?UTF-8?q?[Fix]=20#461=20-=20rightArrowWithCircle?= =?UTF-8?q?=20=EB=B0=A9=EB=AC=B8=EC=9E=90=20=EB=B7=B0=EC=9D=BC=20=EB=95=8C?= =?UTF-8?q?=20hidden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Cells/DashBoard/DashBoardHeaderView.swift | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardHeaderView.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardHeaderView.swift index 9d2ab2c3..51636844 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardHeaderView.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardHeaderView.swift @@ -53,7 +53,8 @@ extension DashBoardHeaderView { private func setLayout() { self.addSubviews( userInfoLabel, - userHistoryView + userHistoryView, + rightArrowWithCircleImageView ) userInfoLabel.snp.makeConstraints { make in @@ -67,10 +68,6 @@ extension DashBoardHeaderView { make.width.equalTo(250) make.height.equalTo(23) } - } - - private func setRightArrowWithCircleImageViewLayout() { - self.addSubview(rightArrowWithCircleImageView) rightArrowWithCircleImageView.snp.makeConstraints { make in make.centerY.equalToSuperview() @@ -87,11 +84,13 @@ extension DashBoardHeaderView { switch userType { case .visitor: self.userInfoLabel.text = I18N.Home.DashBoard.UserHistory.encourage + self.rightArrowWithCircleImageView.isHidden = true case .active, .inactive: self.userInfoLabel.text = "김솝트 님은\nSOPT와 N개월 째" - setRightArrowWithCircleImageViewLayout() + self.rightArrowWithCircleImageView.isHidden = false } + self.userInfoLabel.setLineSpacing(lineSpacing: 5) userHistoryView.setData(userType: userType, recentHistory: 35, allHistory: [35, 34, 33, 32, 31, 30, 29]) } } From a886a8c6edc630ed812a05cd19d456b21ec0ef6d Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Mon, 9 Dec 2024 09:15:30 +0900 Subject: [PATCH 04/12] =?UTF-8?q?[Feat]=20#461=20-=20=EB=8C=80=EC=8B=9C?= =?UTF-8?q?=EB=B3=B4=EB=93=9C=20=EC=84=B9=EC=85=98=20UI=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 --- .../HomeForVisitorCompositionalLayout.swift | 7 +++- .../HomeScene/VC/HomeForMemberVC.swift | 2 +- .../HomeScene/VC/HomeForVisitorVC.swift | 39 ++++++++++++++++++- .../Views/HomeDefaultHeaderView.swift | 8 +++- 4 files changed, 50 insertions(+), 6 deletions(-) diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift index b1600d96..fb12820a 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift @@ -42,11 +42,16 @@ extension HomeForVisitorVC { elementKind: UICollectionView.elementKindSectionHeader, alignment: .top) + /// item 지정: 헤더만 존재 + let emptyItemSize = NSCollectionLayoutSize(widthDimension: .absolute(0), + heightDimension: .absolute(0)) + let emptyItem = NSCollectionLayoutItem(layoutSize: emptyItemSize) + /// group 지정: 헤더만 존재 let emptyGroupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .absolute(0)) let emptyGroup = NSCollectionLayoutGroup.vertical(layoutSize: emptyGroupSize, - subitems: []) + subitems: [emptyItem]) /// section 지정 let section = NSCollectionLayoutSection(group: emptyGroup) 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 df9a114d..2b777f03 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForMemberVC.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForMemberVC.swift @@ -156,7 +156,7 @@ extension HomeForMemberVC: UICollectionViewDataSource { .dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: HomeDefaultHeaderView.className, for: indexPath) as? HomeDefaultHeaderView else { return UICollectionReusableView() } - headerView.setData(sectionKind: sectionKind) + headerView.setDataForMember(sectionKind: sectionKind) return headerView } } /// Footer View diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift index 49bda183..3bd36d05 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift @@ -52,6 +52,8 @@ final class HomeForVisitorVC: UIViewController, HomeForVisitorViewControllable { super.viewDidLoad() setUI() setLayout() + setDelegate() + registerCells() } } @@ -89,7 +91,10 @@ extension HomeForVisitorVC { } private func registerCells() { - + /// Header + self.collectionView.register(DashBoardHeaderView.self, + forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, + withReuseIdentifier: DashBoardHeaderView.className) } } @@ -102,10 +107,40 @@ extension HomeForVisitorVC: UICollectionViewDelegate { // MARK: - UICollectionViewDataSource extension HomeForVisitorVC: UICollectionViewDataSource { - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + func numberOfSections(in collectionView: UICollectionView) -> Int { return HomeForVisitorSectionLayoutKind.allCases.count } + func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { + guard let sectionKind = HomeForVisitorSectionLayoutKind(rawValue: indexPath.section) else { return UICollectionReusableView() } + + switch sectionKind { + case .dashBoard: + guard let headerView = collectionView + .dequeueReusableSupplementaryView(ofKind: kind, + withReuseIdentifier: DashBoardHeaderView.className, + for: indexPath) as? DashBoardHeaderView else { return UICollectionReusableView() } + headerView.setData(userType: .visitor) + return headerView + default: + guard let headerView = collectionView + .dequeueReusableSupplementaryView(ofKind: kind, + withReuseIdentifier: HomeDefaultHeaderView.className, + for: indexPath) as? HomeDefaultHeaderView else { return UICollectionReusableView() } + headerView.setDataForVisitor(sectionKind: sectionKind) + return headerView + } + } + + public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + guard let sectionKind = HomeForVisitorSectionLayoutKind(rawValue: section) else { return 0 } + + switch sectionKind { + case .dashBoard: return 1 + default: return 0 + } + } + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let sectionKind = HomeForVisitorSectionLayoutKind(rawValue: indexPath.section) else { return UICollectionViewCell() } switch sectionKind { diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Views/HomeDefaultHeaderView.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Views/HomeDefaultHeaderView.swift index 2cb27927..016b5fb8 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Views/HomeDefaultHeaderView.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Views/HomeDefaultHeaderView.swift @@ -77,10 +77,14 @@ extension HomeDefaultHeaderView { // MARK: - Methods extension HomeDefaultHeaderView { - func setData(sectionKind: HomeForMemberSectionLayoutKind) { + func setDataForMember(sectionKind: HomeForMemberSectionLayoutKind) { self.titleLabel.text = sectionKind.title self.viewAllButton.isHidden = (sectionKind == .appService) ? true : false self.coffechatLogoImageView.isHidden = (sectionKind == .coffeeChat) ? false : true } + + func setDataForVisitor(sectionKind: HomeForVisitorSectionLayoutKind) { + self.titleLabel.text = sectionKind.title + self.viewAllButton.isHidden = true + } } - From f5a6a4077cefbe24e87ae4e9c875513b43e9b97d Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Wed, 18 Dec 2024 19:31:33 +0900 Subject: [PATCH 05/12] =?UTF-8?q?[Add]=20#461=20-=20=EB=8C=80=EC=8B=9C?= =?UTF-8?q?=EB=B3=B4=EB=93=9C=20=EA=B4=80=EB=A0=A8=20StringLiterals=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift b/SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift index 5dee6ede..5b4b4ac0 100644 --- a/SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift +++ b/SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift @@ -246,6 +246,7 @@ public struct I18N { } public struct MainProduct { + public static let headerTitleForVisitor = "SOPT를 더 알고 싶다면, 둘러보세요" public static let playground = "Playground" public static let groupAndStudy = "모임/스터디" public static let member = "멤버" From 85c684caee5453d101f84a1ad6d59a76493c60e1 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Wed, 18 Dec 2024 19:33:08 +0900 Subject: [PATCH 06/12] =?UTF-8?q?[Fix]=20#461=20-=20=EB=8C=80=EC=8B=9C?= =?UTF-8?q?=EB=B3=B4=EB=93=9C=20=EC=84=B9=EC=85=98=20->=20=EB=8C=80?= =?UTF-8?q?=EC=8B=9C=EB=B3=B4=EB=93=9C=20/=20=EC=BA=98=EB=A6=B0=EB=8D=94?= =?UTF-8?q?=20=EC=84=B9=EC=85=98=EC=9C=BC=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= =?UTF-8?q?=ED=95=98=EA=B8=B0=20=EC=9C=84=ED=95=9C=20=EB=AA=85=EC=B9=AD=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CalendarCardCVC.swift} | 6 +++--- ...ashBoardHeaderView.swift => DashBoardCardCVC.swift} | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) rename SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/{DashBoard/DashBoardCalendarCardCVC.swift => Calendar/CalendarCardCVC.swift} (96%) rename SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/{DashBoardHeaderView.swift => DashBoardCardCVC.swift} (92%) diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardCalendarCardCVC.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/Calendar/CalendarCardCVC.swift similarity index 96% rename from SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardCalendarCardCVC.swift rename to SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/Calendar/CalendarCardCVC.swift index 994f1726..c89cd770 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardCalendarCardCVC.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/Calendar/CalendarCardCVC.swift @@ -11,7 +11,7 @@ import UIKit import Core import DSKit -final class DashBoardCalendarCardCVC: UICollectionViewCell { +final class CalendarCardCVC: UICollectionViewCell { // MARK: - UI Components @@ -83,7 +83,7 @@ final class DashBoardCalendarCardCVC: UICollectionViewCell { // MARK: - UI & Layout -extension DashBoardCalendarCardCVC { +extension CalendarCardCVC { private func setUI() { self.backgroundColor = DSKitAsset.Colors.gray800.color self.layer.cornerRadius = 8 @@ -122,7 +122,7 @@ extension DashBoardCalendarCardCVC { // MARK: - Methods -extension DashBoardCalendarCardCVC { +extension CalendarCardCVC { func configureCell(date: String, tagType: DashBoardCalenderCategoryTagType, title: String, userType: UserType) { self.dateLabel.text = date self.scheduleTitleLabel.text = title diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardHeaderView.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardCardCVC.swift similarity index 92% rename from SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardHeaderView.swift rename to SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardCardCVC.swift index 51636844..f2f9fe20 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardHeaderView.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardCardCVC.swift @@ -1,5 +1,5 @@ // -// DashBoardHeaderView.swift +// DashBoardCardCVC.swift // HomeFeature // // Created by Jae Hyun Lee on 11/22/24. @@ -11,7 +11,7 @@ import UIKit import Core import DSKit -final class DashBoardHeaderView: UICollectionReusableView { +final class DashBoardCardCVC: UICollectionViewCell { // MARK: - UI Components @@ -44,7 +44,7 @@ final class DashBoardHeaderView: UICollectionReusableView { // MARK: - UI & Layout -extension DashBoardHeaderView { +extension DashBoardCardCVC { private func setUI() { self.backgroundColor = DSKitAsset.Colors.gray800.color self.layer.cornerRadius = 8 @@ -79,8 +79,8 @@ extension DashBoardHeaderView { // MARK: - Methods -extension DashBoardHeaderView { - func setData(userType: UserType) { +extension DashBoardCardCVC { + func configureCell(userType: UserType) { switch userType { case .visitor: self.userInfoLabel.text = I18N.Home.DashBoard.UserHistory.encourage From c2c12492ac2ce7a6eb63af237cb497cb559c3ec7 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Wed, 18 Dec 2024 19:35:53 +0900 Subject: [PATCH 07/12] =?UTF-8?q?[Fix]=20#461=20-=20HomeForMemberView=20->?= =?UTF-8?q?=20=EB=8C=80=EC=8B=9C=EB=B3=B4=EB=93=9C/=EC=BA=98=EB=A6=B0?= =?UTF-8?q?=EB=8D=94=20=EC=84=B9=EC=85=98=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeForMemberCompositionalLayout.swift | 32 +++++++--- .../HomeForMemberSectionLayoutKind.swift | 1 + .../HomeScene/VC/HomeForMemberVC.swift | 60 +++++++++---------- 3 files changed, 53 insertions(+), 40 deletions(-) diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForMemberCompositionalLayout.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForMemberCompositionalLayout.swift index 5603255d..fb3f3e5c 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForMemberCompositionalLayout.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForMemberCompositionalLayout.swift @@ -31,6 +31,8 @@ extension HomeForMemberVC { switch sectionKind { case .dashBoard: return self.createDashBoardSection() + case .calendar: + return self.createCalendarSection() case .mainProduct: return self.createMainProductSection() case .appService: @@ -45,20 +47,33 @@ extension HomeForMemberVC { return self.createCoffeeChatSection() case .socialLinks: return self.createSocialLinksSection() - default: - return self.createEmptySection() } } } private func createDashBoardSection() -> NSCollectionLayoutSection { - /// header: 유저 정보 및 활동 히스토리 - let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), - heightDimension: .absolute(123)) - let header = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerSize, - elementKind: UICollectionView.elementKindSectionHeader, - alignment: .top) + /// item: 유저 정보 및 활동 히스토리 카드 + let dashBoardItemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), + heightDimension: .absolute(123)) + let dashBoardItem = NSCollectionLayoutItem(layoutSize: dashBoardItemSize) + /// group: 유저 정보 및 활동 히스토리 카드 + let dashBoardGroupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), + heightDimension: .estimated(123)) + let dashBoardGroup = NSCollectionLayoutGroup.vertical(layoutSize: dashBoardGroupSize, + subitems: [dashBoardItem]) + + /// section 지정 + let section = NSCollectionLayoutSection(group: dashBoardGroup) + section.contentInsets = NSDirectionalEdgeInsets(top: 12, + leading: Metric.collectionViewDefaultSideInset, + bottom: 0, + trailing: Metric.collectionViewDefaultSideInset) + + return section + } + + private func createCalendarSection() -> NSCollectionLayoutSection { /// item: 캘린더 카드 let calendarItemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .absolute(56)) @@ -72,7 +87,6 @@ extension HomeForMemberVC { /// section 지정 let section = NSCollectionLayoutSection(group: calendarGroup) - section.boundarySupplementaryItems = [header] section.contentInsets = NSDirectionalEdgeInsets(top: 12, leading: Metric.collectionViewDefaultSideInset, bottom: 0, diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForMemberSectionLayoutKind.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForMemberSectionLayoutKind.swift index 01c98d81..0b07fd68 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForMemberSectionLayoutKind.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForMemberSectionLayoutKind.swift @@ -12,6 +12,7 @@ import Core enum HomeForMemberSectionLayoutKind: Int, CaseIterable { case dashBoard + case calendar case mainProduct case appService case insight 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 2b777f03..5227924f 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForMemberVC.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForMemberVC.swift @@ -72,7 +72,7 @@ extension HomeForMemberVC { ) naviBar.snp.makeConstraints { make in - make.leading.top.trailing.equalTo(view.safeAreaLayoutGuide) + make.leading.top.trailing.equalTo(view.safeAreaLayoutGuide) } collectionView.snp.makeConstraints { make in @@ -92,16 +92,15 @@ extension HomeForMemberVC { private func registerCells() { /// Header - self.collectionView.register(DashBoardHeaderView.self, - forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, - withReuseIdentifier: DashBoardHeaderView.className) self.collectionView.register(HomeDefaultHeaderView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: HomeDefaultHeaderView.className) /// Cell - self.collectionView.register(DashBoardCalendarCardCVC.self, - forCellWithReuseIdentifier: DashBoardCalendarCardCVC.className) + self.collectionView.register(DashBoardCardCVC.self, + forCellWithReuseIdentifier: DashBoardCardCVC.className) + self.collectionView.register(CalendarCardCVC.self, + forCellWithReuseIdentifier: CalendarCardCVC.className) self.collectionView.register(MainProductCardCVC.self, forCellWithReuseIdentifier: MainProductCardCVC.className) self.collectionView.register(AppServiceCardCVC.self, @@ -142,23 +141,12 @@ extension HomeForMemberVC: UICollectionViewDataSource { /// Header View if kind == UICollectionView.elementKindSectionHeader { - switch sectionKind { - /// dashBoard일 경우에만 defaultHeader 대신 UserHistory가 나타나는 커스텀 헤더를 사용합니다. - case .dashBoard: - guard let headerView = collectionView - .dequeueReusableSupplementaryView(ofKind: kind, - withReuseIdentifier: DashBoardHeaderView.className, - for: indexPath) as? DashBoardHeaderView else { return UICollectionReusableView() } - headerView.setData(userType: .active) - return headerView - default: - guard let headerView = collectionView - .dequeueReusableSupplementaryView(ofKind: kind, - withReuseIdentifier: HomeDefaultHeaderView.className, - for: indexPath) as? HomeDefaultHeaderView else { return UICollectionReusableView() } - headerView.setDataForMember(sectionKind: sectionKind) - return headerView - } + guard let headerView = collectionView + .dequeueReusableSupplementaryView(ofKind: kind, + withReuseIdentifier: HomeDefaultHeaderView.className, + for: indexPath) as? HomeDefaultHeaderView else { return UICollectionReusableView() } + headerView.setDataForMember(sectionKind: sectionKind) + return headerView } /// Footer View else if kind == UICollectionView.elementKindSectionFooter { switch sectionKind { @@ -182,6 +170,7 @@ extension HomeForMemberVC: UICollectionViewDataSource { switch sectionKind { case .dashBoard: return 1 + case .calendar: return 1 case .mainProduct: return viewModel.productInfoList.count case .appService: return viewModel.appServiceInfoList.count case .insight: return viewModel.insightInfoList.count @@ -189,7 +178,6 @@ extension HomeForMemberVC: UICollectionViewDataSource { case .coffeeChat: return viewModel.coffeeChatHostInfoList.count case .announcement: return viewModel.announcementInfoList.count case .socialLinks: return SocialLinkCardType.allCases.count - default: return 0 } } @@ -198,14 +186,24 @@ extension HomeForMemberVC: UICollectionViewDataSource { switch sectionKind { case .dashBoard: + /// 대시보드 카드 셀 + guard let dashBoardCardCell = collectionView + .dequeueReusableCell(withReuseIdentifier: DashBoardCardCVC.className, + for: indexPath) as? DashBoardCardCVC else { return UICollectionViewCell() } + dashBoardCardCell.configureCell(userType: .active) + + return dashBoardCardCell + + case .calendar: /// 캘린더 카드 셀 guard let calendarCardCell = collectionView - .dequeueReusableCell(withReuseIdentifier: DashBoardCalendarCardCVC.className, - for: indexPath) as? DashBoardCalendarCardCVC else { return UICollectionViewCell() } + .dequeueReusableCell(withReuseIdentifier: CalendarCardCVC.className, + for: indexPath) as? CalendarCardCVC else { return UICollectionViewCell() } calendarCardCell.configureCell(date: "10.22", - tagType: .event, - title: "1차 행사", - userType: .active) + tagType: .event, + title: "1차 행사", + userType: .active) + return calendarCardCell case .mainProduct: @@ -215,9 +213,9 @@ extension HomeForMemberVC: UICollectionViewDataSource { guard let productCardCell = collectionView .dequeueReusableCell(withReuseIdentifier: MainProductCardCVC.className, for: indexPath) as? MainProductCardCVC else { return UICollectionViewCell() } - productCardCell.configureCell(title: product.name, image: product.image) + return productCardCell case .appService: @@ -230,6 +228,7 @@ extension HomeForMemberVC: UICollectionViewDataSource { appServiceCardCell.configureCell(imageURL: appService.imageURL, name: appService.name, badgeText: appService.badgeText) + return appServiceCardCell case .insight: @@ -283,7 +282,6 @@ extension HomeForMemberVC: UICollectionViewDataSource { socialLinkCardCell.configureCell(type: socialLinkType) return socialLinkCardCell - default: return UICollectionViewCell() } } } From 5cb05f4ae4722b89769a5ce98612b6723eae93c4 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Wed, 18 Dec 2024 19:37:05 +0900 Subject: [PATCH 08/12] =?UTF-8?q?[Fix]=20#461=20-=20=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=EB=8D=95=ED=8A=B8=20=EC=84=B9=EC=85=98=20?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=95=84=EC=9B=83=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeForVisitorCompositionalLayout.swift | 54 ++++++++++++++----- .../HomeForVisitorSectionLayoutKind.swift | 2 + .../HomeScene/VC/HomeForVisitorVC.swift | 54 ++++++++++++------- 3 files changed, 77 insertions(+), 33 deletions(-) diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift index fb12820a..1b84f115 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift @@ -16,6 +16,7 @@ extension HomeForVisitorVC { static let defaultItemSpacing: Double = 16 static let defaultGroupSpacing: Double = 12 static let defaultLineSpacing: Double = 56 + static let defaultSectionSpacing: Double = 36 static let productItemSpacing: Double = 15 static let appServiceItemSpacing: Double = 16 @@ -28,6 +29,8 @@ extension HomeForVisitorVC { switch sectionKind { case .dashBoard: return self.createDashBoardSection() + case .mainProduct: + return self.createMainProductSection() default: return self.createEmptySection() } @@ -35,30 +38,53 @@ extension HomeForVisitorVC { } private func createDashBoardSection() -> NSCollectionLayoutSection { - /// header: 유저 정보 및 활동 히스토리 + /// item: 대시보드 카드 + let dashBoardItemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), + heightDimension: .absolute(123)) + let dashBoardItem = NSCollectionLayoutItem(layoutSize: dashBoardItemSize) + + /// group: 대시보드 카드 + let dashBoardGroupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), + heightDimension: .estimated(123)) + let dashBoardGroup = NSCollectionLayoutGroup.vertical(layoutSize: dashBoardGroupSize, + subitems: [dashBoardItem]) + + /// section 지정 + let section = NSCollectionLayoutSection(group: dashBoardGroup) + section.contentInsets = NSDirectionalEdgeInsets(top: Metric.defaultGroupSpacing, + leading: Metric.collectionViewDefaultSideInset, + bottom: Metric.defaultSectionSpacing, + trailing: Metric.collectionViewDefaultSideInset) + + return section + } + + private func createMainProductSection() -> NSCollectionLayoutSection { + /// header: default let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), - heightDimension: .absolute(123)) + heightDimension: .absolute(30)) let header = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerSize, elementKind: UICollectionView.elementKindSectionHeader, alignment: .top) - /// item 지정: 헤더만 존재 - let emptyItemSize = NSCollectionLayoutSize(widthDimension: .absolute(0), - heightDimension: .absolute(0)) - let emptyItem = NSCollectionLayoutItem(layoutSize: emptyItemSize) + /// item: 프로덕트 카드 + let productItemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.25), + heightDimension: .absolute(92)) + let productItem = NSCollectionLayoutItem(layoutSize: productItemSize) - /// group 지정: 헤더만 존재 - let emptyGroupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), - heightDimension: .absolute(0)) - let emptyGroup = NSCollectionLayoutGroup.vertical(layoutSize: emptyGroupSize, - subitems: [emptyItem]) + /// group: 프로덕트 카드 + let productGroupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), + heightDimension: .estimated(92)) + let productGroup = NSCollectionLayoutGroup.horizontal(layoutSize: productGroupSize, + subitems: [productItem]) + productGroup.interItemSpacing = .fixed(Metric.productItemSpacing) /// section 지정 - let section = NSCollectionLayoutSection(group: emptyGroup) + let section = NSCollectionLayoutSection(group: productGroup) section.boundarySupplementaryItems = [header] - section.contentInsets = NSDirectionalEdgeInsets(top: 12, + section.contentInsets = NSDirectionalEdgeInsets(top: Metric.defaultItemSpacing, leading: Metric.collectionViewDefaultSideInset, - bottom: 0, + bottom: 40, trailing: Metric.collectionViewDefaultSideInset) return section diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorSectionLayoutKind.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorSectionLayoutKind.swift index c4b7c644..c86e8658 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorSectionLayoutKind.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorSectionLayoutKind.swift @@ -17,6 +17,8 @@ enum HomeForVisitorSectionLayoutKind: Int, CaseIterable { var title: String { switch self { + case .mainProduct: + return I18N.Home.MainProduct.headerTitleForVisitor case .appService: return I18N.Home.AppService.headerTitle default: diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift index 3bd36d05..33865179 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift @@ -92,9 +92,15 @@ extension HomeForVisitorVC { private func registerCells() { /// Header - self.collectionView.register(DashBoardHeaderView.self, + self.collectionView.register(HomeDefaultHeaderView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, - withReuseIdentifier: DashBoardHeaderView.className) + withReuseIdentifier: HomeDefaultHeaderView.className) + + /// Cell + self.collectionView.register(DashBoardCardCVC.self, + forCellWithReuseIdentifier: DashBoardCardCVC.className) + self.collectionView.register(MainProductCardCVC.self, + forCellWithReuseIdentifier: MainProductCardCVC.className) } } @@ -113,23 +119,12 @@ extension HomeForVisitorVC: UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { guard let sectionKind = HomeForVisitorSectionLayoutKind(rawValue: indexPath.section) else { return UICollectionReusableView() } - - switch sectionKind { - case .dashBoard: - guard let headerView = collectionView - .dequeueReusableSupplementaryView(ofKind: kind, - withReuseIdentifier: DashBoardHeaderView.className, - for: indexPath) as? DashBoardHeaderView else { return UICollectionReusableView() } - headerView.setData(userType: .visitor) - return headerView - default: - guard let headerView = collectionView - .dequeueReusableSupplementaryView(ofKind: kind, - withReuseIdentifier: HomeDefaultHeaderView.className, - for: indexPath) as? HomeDefaultHeaderView else { return UICollectionReusableView() } - headerView.setDataForVisitor(sectionKind: sectionKind) - return headerView - } + guard let headerView = collectionView + .dequeueReusableSupplementaryView(ofKind: kind, + withReuseIdentifier: HomeDefaultHeaderView.className, + for: indexPath) as? HomeDefaultHeaderView else { return UICollectionReusableView() } + headerView.setDataForVisitor(sectionKind: sectionKind) + return headerView } public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { @@ -137,6 +132,7 @@ extension HomeForVisitorVC: UICollectionViewDataSource { switch sectionKind { case .dashBoard: return 1 + case .mainProduct: return viewModel.productInfoList.count default: return 0 } } @@ -144,6 +140,26 @@ extension HomeForVisitorVC: UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let sectionKind = HomeForVisitorSectionLayoutKind(rawValue: indexPath.section) else { return UICollectionViewCell() } switch sectionKind { + case .dashBoard: + /// 대시보드 카드 셀 + guard let dashBoardCardCell = collectionView + .dequeueReusableCell(withReuseIdentifier: DashBoardCardCVC.className, + for: indexPath) as? DashBoardCardCVC else { return UICollectionViewCell() } + dashBoardCardCell.configureCell(userType: .visitor) + + return dashBoardCardCell + + case .mainProduct: + /// 프로덕트 카드 셀 + let productIndex = indexPath.item + guard let product = viewModel.productInfoList[safe: productIndex] else { return UICollectionViewCell() } + guard let productCardCell = collectionView + .dequeueReusableCell(withReuseIdentifier: MainProductCardCVC.className, + for: indexPath) as? MainProductCardCVC else { return UICollectionViewCell() } + productCardCell.configureCell(title: product.name, + image: product.image) + + return productCardCell default: return UICollectionViewCell() } } From 247958f3222d4a66c0f6dbb0c901626fb7a45cc4 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Wed, 18 Dec 2024 20:04:17 +0900 Subject: [PATCH 09/12] =?UTF-8?q?[Add]=20#461=20-=20=EB=8D=94=EB=AF=B8=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModel/HomeForVisitorViewModel.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/ViewModel/HomeForVisitorViewModel.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/ViewModel/HomeForVisitorViewModel.swift index 8bc612aa..ec9d2c69 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/ViewModel/HomeForVisitorViewModel.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/ViewModel/HomeForVisitorViewModel.swift @@ -11,12 +11,29 @@ import Combine import Core import Domain +import DSKit import HomeFeatureInterface import BaseFeatureDependency public class HomeForVisitorViewModel: HomeForVisitorViewModelType { + // MARK: - Properties + + let productInfoList: [ProductInfo] = [ + ProductInfo(name: I18N.Home.MainProduct.homePage, image: DSKitAsset.Assets.icHomepage.image), + ProductInfo(name: I18N.Home.MainProduct.activityReview, image: DSKitAsset.Assets.imgGroupLogo.image), + ProductInfo(name: I18N.Home.MainProduct.project, image: DSKitAsset.Assets.imgMemberLogo.image), + ProductInfo(name: I18N.Home.MainProduct.instagram, image: DSKitAsset.Assets.icInstagram.image) + ] + + // TODO: 서버 연결 필요 + let appServiceInfoList: [AppServiceInfo] = [ + AppServiceInfo(name: "콕찌르기", imageURL: "https://images.mypetlife.co.kr/content/uploads/2018/12/09154907/cotton-tulear-2422612_1280.jpg", badgeText: ""), + AppServiceInfo(name: "솝마디", imageURL: "https://images.mypetlife.co.kr/content/uploads/2018/12/09154907/cotton-tulear-2422612_1280.jpg", badgeText: ""), + AppServiceInfo(name: "솝탬프", imageURL: "https://images.mypetlife.co.kr/content/uploads/2018/12/09154907/cotton-tulear-2422612_1280.jpg", badgeText: "") + ] + // MARK: - Inputs public struct Input { } From bd18c5920af77bef0e3577a0ed271353f262d19f Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Wed, 18 Dec 2024 20:05:05 +0900 Subject: [PATCH 10/12] =?UTF-8?q?[Feat]=20#461=20-=20=EC=95=B1=20=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4=20=EC=84=B9=EC=85=98=20=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EC=95=84=EC=9B=83=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Cells/AppService/AppServiceCardCVC.swift | 6 +++- .../HomeForVisitorCompositionalLayout.swift | 36 +++++++++++++++++-- .../HomeScene/VC/HomeForVisitorVC.swift | 18 ++++++++-- 3 files changed, 54 insertions(+), 6 deletions(-) diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/AppService/AppServiceCardCVC.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/AppService/AppServiceCardCVC.swift index 55d4530d..445d24ba 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/AppService/AppServiceCardCVC.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/AppService/AppServiceCardCVC.swift @@ -80,6 +80,10 @@ extension AppServiceCardCVC { func configureCell(imageURL: String, name: String, badgeText: String) { self.logoImageView.setImage(with: imageURL) self.titleLabel.text = name - self.notificationBadgeView.setData(with: badgeText) + if badgeText.isEmpty { + self.notificationBadgeView.isHidden = true + } else { + self.notificationBadgeView.setData(with: badgeText) + } } } diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift index 1b84f115..49355069 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/CollectionView/HomeForVisitorCompositionalLayout.swift @@ -31,8 +31,8 @@ extension HomeForVisitorVC { return self.createDashBoardSection() case .mainProduct: return self.createMainProductSection() - default: - return self.createEmptySection() + case .appService: + return self.createAppServiceSection() } } } @@ -51,7 +51,7 @@ extension HomeForVisitorVC { /// section 지정 let section = NSCollectionLayoutSection(group: dashBoardGroup) - section.contentInsets = NSDirectionalEdgeInsets(top: Metric.defaultGroupSpacing, + section.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: Metric.collectionViewDefaultSideInset, bottom: Metric.defaultSectionSpacing, trailing: Metric.collectionViewDefaultSideInset) @@ -90,6 +90,36 @@ extension HomeForVisitorVC { return section } + private func createAppServiceSection() -> NSCollectionLayoutSection { + /// header: default + let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), + heightDimension: .absolute(30)) + let header = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerSize, + elementKind: UICollectionView.elementKindSectionHeader, + alignment: .top) + + /// item: 앱 서비스 카드 + let appServiceItemSize = NSCollectionLayoutSize(widthDimension: .absolute(80), + heightDimension: .absolute(106)) + let appServiceItem = NSCollectionLayoutItem(layoutSize: appServiceItemSize) + + /// group: 앱 서비스 카드 + let appServiceGroupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), + heightDimension: .estimated(106)) + let appServiceGroup = NSCollectionLayoutGroup.horizontal(layoutSize: appServiceGroupSize, + subitems: [appServiceItem]) + appServiceGroup.interItemSpacing = .fixed(Metric.appServiceItemSpacing) + + /// section 지정 + let section = NSCollectionLayoutSection(group: appServiceGroup) + section.boundarySupplementaryItems = [header] + section.contentInsets = NSDirectionalEdgeInsets(top: Metric.defaultItemSpacing, + leading: Metric.collectionViewDefaultSideInset, + bottom: Metric.defaultLineSpacing, + trailing: Metric.collectionViewDefaultSideInset) + return section + } + private func createEmptySection() -> NSCollectionLayoutSection { let itemSize = NSCollectionLayoutSize(widthDimension: .absolute(1), heightDimension: .absolute(1)) diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift index 33865179..d1cd4ed2 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/VC/HomeForVisitorVC.swift @@ -101,6 +101,8 @@ extension HomeForVisitorVC { forCellWithReuseIdentifier: DashBoardCardCVC.className) self.collectionView.register(MainProductCardCVC.self, forCellWithReuseIdentifier: MainProductCardCVC.className) + self.collectionView.register(AppServiceCardCVC.self, + forCellWithReuseIdentifier: AppServiceCardCVC.className) } } @@ -133,7 +135,7 @@ extension HomeForVisitorVC: UICollectionViewDataSource { switch sectionKind { case .dashBoard: return 1 case .mainProduct: return viewModel.productInfoList.count - default: return 0 + case .appService: return viewModel.appServiceInfoList.count } } @@ -160,7 +162,19 @@ extension HomeForVisitorVC: UICollectionViewDataSource { image: product.image) return productCardCell - default: return UICollectionViewCell() + + case .appService: + /// 앱 서비스 카드 셀 + let appServiceIndex = indexPath.item + guard let appService = viewModel.appServiceInfoList[safe: appServiceIndex] else { return UICollectionViewCell() } + guard let appServiceCardCell = collectionView + .dequeueReusableCell(withReuseIdentifier: AppServiceCardCVC.className, + for: indexPath) as? AppServiceCardCVC else { return UICollectionViewCell() } + appServiceCardCell.configureCell(imageURL: appService.imageURL, + name: appService.name, + badgeText: appService.badgeText) + + return appServiceCardCell } } } From c6e32cd8fd99aa57523afc2589bc31285b5b54bb Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Wed, 18 Dec 2024 20:06:37 +0900 Subject: [PATCH 11/12] =?UTF-8?q?[Fix]=20#461=20-=20git=20conflict=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 폴더 위치 변경 --- .../{ => HomeScene}/Cells/Announcements/AnnouncementCardCVC.swift | 0 .../Cells/Announcements/AnnouncementPageContolFooterView.swift | 0 .../{ => HomeScene}/Cells/SocialLinks/SocialLinkCardCVC.swift | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename SOPT-iOS/Projects/Features/HomeFeature/Sources/{ => HomeScene}/Cells/Announcements/AnnouncementCardCVC.swift (100%) rename SOPT-iOS/Projects/Features/HomeFeature/Sources/{ => HomeScene}/Cells/Announcements/AnnouncementPageContolFooterView.swift (100%) rename SOPT-iOS/Projects/Features/HomeFeature/Sources/{ => HomeScene}/Cells/SocialLinks/SocialLinkCardCVC.swift (100%) diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/Cells/Announcements/AnnouncementCardCVC.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/Announcements/AnnouncementCardCVC.swift similarity index 100% rename from SOPT-iOS/Projects/Features/HomeFeature/Sources/Cells/Announcements/AnnouncementCardCVC.swift rename to SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/Announcements/AnnouncementCardCVC.swift diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/Cells/Announcements/AnnouncementPageContolFooterView.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/Announcements/AnnouncementPageContolFooterView.swift similarity index 100% rename from SOPT-iOS/Projects/Features/HomeFeature/Sources/Cells/Announcements/AnnouncementPageContolFooterView.swift rename to SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/Announcements/AnnouncementPageContolFooterView.swift diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/Cells/SocialLinks/SocialLinkCardCVC.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/SocialLinks/SocialLinkCardCVC.swift similarity index 100% rename from SOPT-iOS/Projects/Features/HomeFeature/Sources/Cells/SocialLinks/SocialLinkCardCVC.swift rename to SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/SocialLinks/SocialLinkCardCVC.swift From 11492693231261416f69236842017cd376090a33 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:49:25 +0900 Subject: [PATCH 12/12] =?UTF-8?q?[Fix]=20#461=20-=20=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=EB=8D=95=ED=8A=B8=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=EC=BD=98=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModel/HomeForVisitorViewModel.swift | 4 ++-- .../Home/Image/img_homepage.imageset/Contents.json | 12 ++++++++++++ .../Image/img_homepage.imageset/icn_homepage.svg | 5 +++++ .../Home/Image/img_instagram.imageset/Contents.json | 12 ++++++++++++ .../img_instagram.imageset/Frame 1171275665.svg | 13 +++++++++++++ 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_homepage.imageset/Contents.json create mode 100644 SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_homepage.imageset/icn_homepage.svg create mode 100644 SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_instagram.imageset/Contents.json create mode 100644 SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_instagram.imageset/Frame 1171275665.svg diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/ViewModel/HomeForVisitorViewModel.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/ViewModel/HomeForVisitorViewModel.swift index ec9d2c69..ddee8c91 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/ViewModel/HomeForVisitorViewModel.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/ViewModel/HomeForVisitorViewModel.swift @@ -21,10 +21,10 @@ public class HomeForVisitorViewModel: HomeForVisitorViewModelType { // MARK: - Properties let productInfoList: [ProductInfo] = [ - ProductInfo(name: I18N.Home.MainProduct.homePage, image: DSKitAsset.Assets.icHomepage.image), + ProductInfo(name: I18N.Home.MainProduct.homePage, image: DSKitAsset.Assets.imgHomepage.image), ProductInfo(name: I18N.Home.MainProduct.activityReview, image: DSKitAsset.Assets.imgGroupLogo.image), ProductInfo(name: I18N.Home.MainProduct.project, image: DSKitAsset.Assets.imgMemberLogo.image), - ProductInfo(name: I18N.Home.MainProduct.instagram, image: DSKitAsset.Assets.icInstagram.image) + ProductInfo(name: I18N.Home.MainProduct.instagram, image: DSKitAsset.Assets.imgInstagram.image) ] // TODO: 서버 연결 필요 diff --git a/SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_homepage.imageset/Contents.json b/SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_homepage.imageset/Contents.json new file mode 100644 index 00000000..5c0a4a21 --- /dev/null +++ b/SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_homepage.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "icn_homepage.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_homepage.imageset/icn_homepage.svg b/SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_homepage.imageset/icn_homepage.svg new file mode 100644 index 00000000..5a5de6ae --- /dev/null +++ b/SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_homepage.imageset/icn_homepage.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_instagram.imageset/Contents.json b/SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_instagram.imageset/Contents.json new file mode 100644 index 00000000..8bea1346 --- /dev/null +++ b/SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_instagram.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Frame 1171275665.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_instagram.imageset/Frame 1171275665.svg b/SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_instagram.imageset/Frame 1171275665.svg new file mode 100644 index 00000000..864f430c --- /dev/null +++ b/SOPT-iOS/Projects/Modules/DSKit/Resources/Assets.xcassets/Home/Image/img_instagram.imageset/Frame 1171275665.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + +