From 89c0e0d77e4d545b992c93bbe5b48bb9e0e0835d Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Tue, 3 Jan 2023 22:37:13 +0900 Subject: [PATCH 1/5] =?UTF-8?q?[Fix]=20#26=20-=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EC=97=B0=EA=B2=B0=20=EC=9E=98=EB=AA=BB=20=EB=90=98=EC=96=B4?= =?UTF-8?q?=EC=9E=88=EB=8A=94=20=EB=B6=80=EB=B6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/MyPageVC.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/MyPageVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/MyPageVC.swift index 933123bd..7b076c95 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/MyPageVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/MyPageVC.swift @@ -142,7 +142,7 @@ extension MyPageVC { } private func pushToUploadedCourseInfoVC() { - let uploadedCourseInfoVC = ActivityRecordInfoVC() + let uploadedCourseInfoVC = UploadedCourseInfoVC() self.navigationController?.pushViewController(uploadedCourseInfoVC, animated: true) } } @@ -162,7 +162,7 @@ extension MyPageVC { @objc private func uploadedCourseRecordInfoView() { - pushToActivityRecordInfoVC() + pushToUploadedCourseInfoVC() } } From 01720bdf32a8099a6209f9ea17cc87835e1b8659 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Tue, 3 Jan 2023 22:44:17 +0900 Subject: [PATCH 2/5] =?UTF-8?q?[Feat]=20#26=20-=20NavigationBar=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runnect-iOS.xcodeproj/project.pbxproj | 8 +++++++ .../VC/InfoVC/UploadedCourseInfoVC.swift | 21 ++++++++++++++++++- .../Presentation/MyPage/VC/MyPageVC.swift | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 5b59a50e..284a303a 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -212,6 +212,7 @@ A3BC2F292962C39F00198261 /* InfoVC */ = { isa = PBXGroup; children = ( + A3BC2F3B2964671D00198261 /* UploadedCourseInfoCollectionView */, A3BC2F362963CD2100198261 /* ActivityRecordInfoTableView */, A3BC2F302962E08400198261 /* GoalRewardInfoCollectionView */, A3BC2F2A2962C3D500198261 /* GoalRewardInfoVC.swift */, @@ -239,6 +240,13 @@ path = ActivityRecordInfoTableView; sourceTree = ""; }; + A3BC2F3B2964671D00198261 /* UploadedCourseInfoCollectionView */ = { + isa = PBXGroup; + children = ( + ); + path = UploadedCourseInfoCollectionView; + sourceTree = ""; + }; CE17F02E2961BEAE00E1DED0 /* Fonts */ = { isa = PBXGroup; children = ( diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift index fec5bd0c..b80945fe 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift @@ -6,17 +6,36 @@ // import UIKit +import SnapKit +import Then final class UploadedCourseInfoVC: UIViewController { + // MARK: - UI Components + private lazy var navibar = CustomNavigationBar(self, type: .titleWithLeftButton).setTitle("업로드한 코스") + + // MARK: - View Life Cycle + override func viewDidLoad() { super.viewDidLoad() + setNavigationBar() setUI() - // Do any additional setup after loading the view. } } extension UploadedCourseInfoVC { + + // MARK: - Layout Helpers + + private func setNavigationBar() { + view.addSubview(navibar) + + navibar.snp.makeConstraints { make in + make.top.leading.trailing.equalTo(view.safeAreaLayoutGuide) + make.height.equalTo(48) + } + } + private func setUI() { view.backgroundColor = .w1 } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/MyPageVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/MyPageVC.swift index 7b076c95..597713e6 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/MyPageVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/MyPageVC.swift @@ -80,7 +80,7 @@ final class MyPageVC: UIViewController { $0.addGestureRecognizer(tap) } - // MARK: - + // MARK: - View Life Cycle override func viewDidLoad() { super.viewDidLoad() From 6fadc99304411f3a04e211152abc7fec865735b2 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Wed, 4 Jan 2023 12:43:03 +0900 Subject: [PATCH 3/5] [Merge] #26 - pull develop --- .../Runnect-iOS.xcodeproj/project.pbxproj | 8 ++++ .../MyPage/VC/InfoVC/GoalRewardInfoVC.swift | 3 +- .../UploadedCourseInfoCVC.swift | 14 +++++++ .../UploadedCourseInfoModel.swift | 14 +++++++ .../VC/InfoVC/UploadedCourseInfoVC.swift | 40 +++++++++++++++++++ 5 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoCVC.swift create mode 100644 Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoModel.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 284a303a..a36f93ed 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -15,6 +15,8 @@ A3BC2F34296303A600198261 /* GoalRewardInfoCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F33296303A600198261 /* GoalRewardInfoCVC.swift */; }; A3BC2F382963CE3700198261 /* ActivityRecordInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F372963CE3700198261 /* ActivityRecordInfoModel.swift */; }; A3BC2F3A2963D0ED00198261 /* ActivityRecordInfoTVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F392963D0ED00198261 /* ActivityRecordInfoTVC.swift */; }; + A3BC2F3D296468E500198261 /* UploadedCourseInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F3C296468E500198261 /* UploadedCourseInfoModel.swift */; }; + A3BC2F3F2964706100198261 /* UploadedCourseInfoCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F3E2964706100198261 /* UploadedCourseInfoCVC.swift */; }; CE17F02D2961BBA100E1DED0 /* ColorLiterals.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE17F02C2961BBA100E1DED0 /* ColorLiterals.swift */; }; CE17F0332961BEF800E1DED0 /* Pretendard-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = CE17F02F2961BEF800E1DED0 /* Pretendard-Medium.otf */; }; CE17F0342961BEF800E1DED0 /* Pretendard-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = CE17F0302961BEF800E1DED0 /* Pretendard-Bold.otf */; }; @@ -96,6 +98,8 @@ A3BC2F33296303A600198261 /* GoalRewardInfoCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoalRewardInfoCVC.swift; sourceTree = ""; }; A3BC2F372963CE3700198261 /* ActivityRecordInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityRecordInfoModel.swift; sourceTree = ""; }; A3BC2F392963D0ED00198261 /* ActivityRecordInfoTVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityRecordInfoTVC.swift; sourceTree = ""; }; + A3BC2F3C296468E500198261 /* UploadedCourseInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadedCourseInfoModel.swift; sourceTree = ""; }; + A3BC2F3E2964706100198261 /* UploadedCourseInfoCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadedCourseInfoCVC.swift; sourceTree = ""; }; CE17F02C2961BBA100E1DED0 /* ColorLiterals.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorLiterals.swift; sourceTree = ""; }; CE17F02F2961BEF800E1DED0 /* Pretendard-Medium.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Medium.otf"; sourceTree = ""; }; CE17F0302961BEF800E1DED0 /* Pretendard-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Bold.otf"; sourceTree = ""; }; @@ -243,6 +247,8 @@ A3BC2F3B2964671D00198261 /* UploadedCourseInfoCollectionView */ = { isa = PBXGroup; children = ( + A3BC2F3C296468E500198261 /* UploadedCourseInfoModel.swift */, + A3BC2F3E2964706100198261 /* UploadedCourseInfoCVC.swift */, ); path = UploadedCourseInfoCollectionView; sourceTree = ""; @@ -853,9 +859,11 @@ CE6655EE295D88E600C64E12 /* UITextField+.swift in Sources */, CE6655F8295D90CF00C64E12 /* adjusted+.swift in Sources */, CE4545CB295D7AF4003201E1 /* SceneDelegate.swift in Sources */, + A3BC2F3F2964706100198261 /* UploadedCourseInfoCVC.swift in Sources */, CE6655FE295D912300C64E12 /* calculateTopInset.swift in Sources */, CEEC6B492961C5E200D00E1E /* SplashVC.swift in Sources */, CE6655D0295D85FF00C64E12 /* CancelBag.swift in Sources */, + A3BC2F3D296468E500198261 /* UploadedCourseInfoModel.swift in Sources */, CE6655DC295D873500C64E12 /* UIButton+.swift in Sources */, CE6655D4295D865B00C64E12 /* Publisher+UIControl.swift in Sources */, CEB841702963360800BF8080 /* CountDownVC.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/GoalRewardInfoVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/GoalRewardInfoVC.swift index 77cc6cea..e8663a46 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/GoalRewardInfoVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/GoalRewardInfoVC.swift @@ -11,7 +11,7 @@ import Then final class GoalRewardInfoVC: UIViewController { - // MARK: - Variables + // MARK: - Properties var stampList: [GoalRewardInfoModel] = [ GoalRewardInfoModel(stampImg: ImageLiterals.imgStampC1, stampStandard: "그리기 스타터"), @@ -55,7 +55,6 @@ final class GoalRewardInfoVC: UIViewController { layout.scrollDirection = .vertical let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) - collectionView.translatesAutoresizingMaskIntoConstraints = false collectionView.isScrollEnabled = true collectionView.showsVerticalScrollIndicator = false collectionView.delegate = self diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoCVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoCVC.swift new file mode 100644 index 00000000..220e373f --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoCVC.swift @@ -0,0 +1,14 @@ +// +// UploadedCourseInfoCVC.swift +// Runnect-iOS +// +// Created by 몽이 누나 on 2023/01/03. +// + +import UIKit +import SnapKit +import Then + +class UploadedCourseInfoCVC: UICollectionViewCell { + +} diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoModel.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoModel.swift new file mode 100644 index 00000000..cdb597b7 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoModel.swift @@ -0,0 +1,14 @@ +// +// UploadedCourseInfoModel.swift +// Runnect-iOS +// +// Created by 몽이 누나 on 2023/01/03. +// + +import Foundation +import UIKit + +struct UploadedCourseInfoModel { + let title: String + let place: String +} diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift index b80945fe..a8229712 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift @@ -10,16 +10,52 @@ import SnapKit import Then final class UploadedCourseInfoVC: UIViewController { + + // MARK: - Properties + + var UploadedCourseList: [UploadedCourseInfoModel] = [ + UploadedCourseInfoModel(title: "행복한 날들", place: "수원시 장안구"), + UploadedCourseInfoModel(title: "몽이랑 산책", place: "수원시 장안구"), + UploadedCourseInfoModel(title: "패스트파이브", place: "수원시 장안구"), + UploadedCourseInfoModel(title: "행복한 날들", place: "수원시 장안구"), + UploadedCourseInfoModel(title: "몽이랑 산책", place: "수원시 장안구"), + UploadedCourseInfoModel(title: "패스트파이브", place: "수원시 장안구"), + UploadedCourseInfoModel(title: "행복한 날들", place: "수원시 장안구"), + UploadedCourseInfoModel(title: "몽이랑 산책", place: "수원시 장안구"), + UploadedCourseInfoModel(title: "패스트파이브", place: "수원시 장안구") + ] + + // MARK: - Constants + + final let uploadedCourseInset: UIEdgeInsets = UIEdgeInsets(top: 16, left: 16, bottom: 0, right: 16) + final let uploadedCourseLineSpacing: CGFloat = 20 + final let uploadedCourseItemSpacing: CGFloat = 10 + final let uplodaedCourseCellHeight: CGFloat = 124 // MARK: - UI Components + private lazy var navibar = CustomNavigationBar(self, type: .titleWithLeftButton).setTitle("업로드한 코스") + private lazy var UploadedCourseInfoCollectionView: UICollectionView = { + let layout = UICollectionViewFlowLayout() + layout.scrollDirection = .vertical + + let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) + collectionView.isScrollEnabled = true + collectionView.showsVerticalScrollIndicator = false + //collectionView.delegate = self + //collectionView.dataSource = self + + return collectionView + }() + // MARK: - View Life Cycle override func viewDidLoad() { super.viewDidLoad() setNavigationBar() setUI() + setLayout() } } @@ -39,4 +75,8 @@ extension UploadedCourseInfoVC { private func setUI() { view.backgroundColor = .w1 } + + private setLayout() { + + } } From d7111b0b85658b16d7dd493abcabfb56f2c7d984 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:23:19 +0900 Subject: [PATCH 4/5] =?UTF-8?q?[Feat]=20#26=20-=20uploadedCourseInfoCollec?= =?UTF-8?q?tionView=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GoalRewardInfoCVC.swift | 1 - .../MyPage/VC/InfoVC/GoalRewardInfoVC.swift | 4 -- .../UploadedCourseInfoCVC.swift | 70 ++++++++++++++++++- .../VC/InfoVC/UploadedCourseInfoVC.swift | 53 +++++++++++++- 4 files changed, 119 insertions(+), 9 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/GoalRewardInfoCollectionView/GoalRewardInfoCVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/GoalRewardInfoCollectionView/GoalRewardInfoCVC.swift index 6fbe6d0e..44766f52 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/GoalRewardInfoCollectionView/GoalRewardInfoCVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/GoalRewardInfoCollectionView/GoalRewardInfoCVC.swift @@ -15,7 +15,6 @@ final class GoalRewardInfoCVC: UICollectionViewCell { // MARK: - UI Components - private let containerView = UIView() private let stampImageView = UIImageView() private let stampStandardLabel = UILabel().then { $0.textColor = .g1 diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/GoalRewardInfoVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/GoalRewardInfoVC.swift index e8663a46..9b7f69b4 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/GoalRewardInfoVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/GoalRewardInfoVC.swift @@ -143,10 +143,6 @@ extension GoalRewardInfoVC: UICollectionViewDelegateFlowLayout { return stampLineSpacing } - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { - return stampLineSpacing - } - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { return stampInset } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoCVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoCVC.swift index 220e373f..29759562 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoCVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoCVC.swift @@ -9,6 +9,74 @@ import UIKit import SnapKit import Then -class UploadedCourseInfoCVC: UICollectionViewCell { +final class UploadedCourseInfoCVC: UICollectionViewCell { + + // MARK: - UI Components + + private let uploadedCourseMapImage = UIView().then { + $0.layer.cornerRadius = 5 + } + + private let uploadedCourseTitleLabel = UILabel().then { + $0.textColor = .g1 + $0.font = .b4 + } + + private let uploadedCoursePlaceLabel = UILabel().then { + $0.textColor = .g2 + $0.font = .b6 + } + + // MARK: - Life Cycles + + override init(frame: CGRect) { + super.init(frame: frame) + setUI() + setLayout() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +extension UploadedCourseInfoCVC { + + // MARK: - Layout Helpers + + private func setUI() { + uploadedCourseMapImage.backgroundColor = .g3 + } + + private func setLayout() { + contentView.addSubviews(uploadedCourseMapImage, uploadedCourseTitleLabel, uploadedCoursePlaceLabel) + + contentView.snp.makeConstraints { make in + make.top.leading.equalToSuperview() + } + + uploadedCourseMapImage.snp.makeConstraints { make in + make.top.leading.equalToSuperview() + make.width.equalTo(174) + make.height.equalTo(124) + } + + uploadedCourseTitleLabel.snp.makeConstraints { make in + make.top.equalTo(uploadedCourseMapImage.snp.bottom).offset(7) + make.leading.equalToSuperview() + } + + uploadedCoursePlaceLabel.snp.makeConstraints { make in + make.top.equalTo(uploadedCourseTitleLabel.snp.bottom).offset(5) + make.leading.equalToSuperview() + } + } + + // MARK: - General Helpers + + func dataBind(model: UploadedCourseInfoModel) { + uploadedCourseTitleLabel.text = model.title + uploadedCoursePlaceLabel.text = model.place + } } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift index a8229712..35426c86 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift @@ -43,8 +43,8 @@ final class UploadedCourseInfoVC: UIViewController { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) collectionView.isScrollEnabled = true collectionView.showsVerticalScrollIndicator = false - //collectionView.delegate = self - //collectionView.dataSource = self + collectionView.delegate = self + collectionView.dataSource = self return collectionView }() @@ -56,6 +56,7 @@ final class UploadedCourseInfoVC: UIViewController { setNavigationBar() setUI() setLayout() + register() } } @@ -74,9 +75,55 @@ extension UploadedCourseInfoVC { private func setUI() { view.backgroundColor = .w1 + UploadedCourseInfoCollectionView.backgroundColor = .w1 } - private setLayout() { + private func setLayout() { + view.addSubview(UploadedCourseInfoCollectionView) + UploadedCourseInfoCollectionView.snp.makeConstraints { make in + make.top.equalTo(navibar.snp.bottom) + make.leading.trailing.equalTo(view.safeAreaLayoutGuide) + make.bottom.equalToSuperview() + } + } + + // MARK: - General Helpers + + private func register() { + UploadedCourseInfoCollectionView.register(UploadedCourseInfoCVC.self, + forCellWithReuseIdentifier: UploadedCourseInfoCVC.className) + } +} + +// MARK: - UICollectionViewDelegateFlowLayout + +extension UploadedCourseInfoVC: UICollectionViewDelegateFlowLayout { + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + let screenWidth = UIScreen.main.bounds.width + let doubleCellWidth = screenWidth - uploadedCourseInset.left - uploadedCourseInset.right - uploadedCourseItemSpacing + return CGSize(width: doubleCellWidth / 2, height: 164) + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return uploadedCourseLineSpacing + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { + return uploadedCourseInset + } +} + +// MARK: - UICollectionViewDataSource + +extension UploadedCourseInfoVC: UICollectionViewDataSource { + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return UploadedCourseList.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + guard let uploadedCourseCell = collectionView.dequeueReusableCell(withReuseIdentifier: UploadedCourseInfoCVC.className, for: indexPath) as? UploadedCourseInfoCVC else { return UICollectionViewCell()} + uploadedCourseCell.dataBind(model: UploadedCourseList[indexPath.item]) + return uploadedCourseCell } } From 03edb15d9cfa8f1d826434f397798db85bab22cf Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Wed, 4 Jan 2023 14:38:36 +0900 Subject: [PATCH 5/5] =?UTF-8?q?[Fix]=20#26=20-=20=EC=BD=94=EB=A9=98?= =?UTF-8?q?=ED=8A=B8=20=EB=B0=9B=EC=9D=80=20=EB=B6=80=EB=B6=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UploadedCourseInfoCVC.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoCVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoCVC.swift index 29759562..cc844ef1 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoCVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoCollectionView/UploadedCourseInfoCVC.swift @@ -13,7 +13,7 @@ final class UploadedCourseInfoCVC: UICollectionViewCell { // MARK: - UI Components - private let uploadedCourseMapImage = UIView().then { + private let uploadedCourseMapImage = UIImageView().then { $0.layer.cornerRadius = 5 }