From 0a94c061357744ac681bb0df16cc51b3a7a58217 Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Thu, 21 Dec 2023 22:35:24 +0900 Subject: [PATCH 1/7] =?UTF-8?q?[Fix]=20#229=20-=20=EC=BD=94=EC=8A=A4=20?= =?UTF-8?q?=EC=8A=A4=ED=81=AC=EB=9E=A9=20=EC=88=98=20=EB=B6=80=EB=B6=84=20?= =?UTF-8?q?=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.xcodeproj/project.pbxproj | 4 ++++ .../ResponseDto/CourseDetailScrapCountDto.swift | 13 +++++++++++++ .../CourseDetail/VC/CourseDetailVC.swift | 11 ++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 Runnect-iOS/Runnect-iOS/Network/Dto/CourseDetailDto/ResponseDto/CourseDetailScrapCountDto.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index a2fd75f3..1665cf01 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -21,6 +21,7 @@ 7136BF8A2AF921A900679364 /* CustomBottomSheetVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7136BF892AF921A900679364 /* CustomBottomSheetVC.swift */; }; 713A98F02B29DD9900189B3C /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 713A98EF2B29DD9900189B3C /* GoogleService-Info.plist */; }; 717916DA2B13613B009CEF97 /* MarathonListResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 717916D92B13613B009CEF97 /* MarathonListResponseDto.swift */; }; + 71802C5C2B3364C2008DBCEE /* CourseDetailScrapCountDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71802C5B2B3364C2008DBCEE /* CourseDetailScrapCountDto.swift */; }; 71BAD06A2B24CECC0061E31D /* UserProfileDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71BAD0692B24CECC0061E31D /* UserProfileDto.swift */; }; 71BAD06C2B24D1F70061E31D /* UserProfileVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71BAD06B2B24D1F70061E31D /* UserProfileVC.swift */; }; 71F7804E2B0893B600B53253 /* MarathonTitleCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71F7804D2B0893B600B53253 /* MarathonTitleCollectionViewCell.swift */; }; @@ -191,6 +192,7 @@ 7136BF892AF921A900679364 /* CustomBottomSheetVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomBottomSheetVC.swift; sourceTree = ""; }; 713A98EF2B29DD9900189B3C /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 717916D92B13613B009CEF97 /* MarathonListResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarathonListResponseDto.swift; sourceTree = ""; }; + 71802C5B2B3364C2008DBCEE /* CourseDetailScrapCountDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseDetailScrapCountDto.swift; sourceTree = ""; }; 71BAD0692B24CECC0061E31D /* UserProfileDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileDto.swift; sourceTree = ""; }; 71BAD06B2B24D1F70061E31D /* UserProfileVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileVC.swift; sourceTree = ""; }; 71F7804D2B0893B600B53253 /* MarathonTitleCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarathonTitleCollectionViewCell.swift; sourceTree = ""; }; @@ -868,6 +870,7 @@ isa = PBXGroup; children = ( CE4942AC296FCD2300736701 /* UploadedCourseDetailResponseDto.swift */, + 71802C5B2B3364C2008DBCEE /* CourseDetailScrapCountDto.swift */, ); path = ResponseDto; sourceTree = ""; @@ -1538,6 +1541,7 @@ CEB8416E2962C45300BF8080 /* LocationSearchResultTVC.swift in Sources */, CE102C4829DB1D6B00E23E69 /* GetNewTokenResponseDto.swift in Sources */, CE6655CA295D84DD00C64E12 /* UserDefaultKeyList.swift in Sources */, + 71802C5C2B3364C2008DBCEE /* CourseDetailScrapCountDto.swift in Sources */, 712F661D2A7B7BAB00D9539B /* Config.swift in Sources */, 23EE06CB2AC2AF3E00CB3FF8 /* KakaoAddressSearchingResponseDto.swift in Sources */, CE6655F2295D894D00C64E12 /* UIView+.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDetailDto/ResponseDto/CourseDetailScrapCountDto.swift b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDetailDto/ResponseDto/CourseDetailScrapCountDto.swift new file mode 100644 index 00000000..25950623 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDetailDto/ResponseDto/CourseDetailScrapCountDto.swift @@ -0,0 +1,13 @@ +// +// CourseDetailScrapCountDto.swift +// Runnect-iOS +// +// Created by 이명진 on 12/21/23. +// + +import Foundation + + +struct CourseDetailScrapCountDto: Codable { + let scrapCount: Int +} diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index 2ab37a45..b5473748 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -173,6 +173,7 @@ extension CourseDetailVC { let toggle = sender.isSelected ? -1 : 1 self.scrapCount += toggle self.scrapCountLabel.text = "\(self.scrapCount)" + /// print("CourseDetailVC 스크랩 탭🔥publicCourseId=\(publicCourseId), isScrapped은 \(!sender.isSelected) 요렇게 변경 ") } @@ -575,7 +576,14 @@ extension CourseDetailVC { case .success(let result): let status = result.statusCode if 200..<300 ~= status { - self.likeButton.isSelected.toggle() + do { + let responseDto = try result.map(BaseResponse.self) + guard let data = responseDto.data else { return } + self.likeButton.isSelected.toggle() + self.scrapCount = data.scrapCount + } catch { + print(error.localizedDescription) + } } if status >= 400 { print("400 error") @@ -659,3 +667,4 @@ extension CourseDetailVC { } } } + From 92ae95bc022003135fffb7a5b6496d7ff4534295 Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Fri, 22 Dec 2023 23:52:21 +0900 Subject: [PATCH 2/7] =?UTF-8?q?[Chore]=20#229=20-=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=9E=A9=20toggle=20=EB=B6=80=EB=B6=84=20=EC=A3=BC=EC=84=9D?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/CourseDetail/VC/CourseDetailVC.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index b5473748..814668c4 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -170,8 +170,8 @@ extension CourseDetailVC { delegate?.didUpdateScrapState(publicCourseId: publicCourseId, isScrapped: !sender.isSelected) /// UI Update 부분 /// 누른상태(true)에서 누르면 스크랩 취소(false) 하는 이벤트, 즉 -1 - let toggle = sender.isSelected ? -1 : 1 - self.scrapCount += toggle +// let toggle = sender.isSelected ? -1 : 1 +// self.scrapCount += toggle self.scrapCountLabel.text = "\(self.scrapCount)" /// print("CourseDetailVC 스크랩 탭🔥publicCourseId=\(publicCourseId), isScrapped은 \(!sender.isSelected) 요렇게 변경 ") From bf0488c9fc8eef5778731e9dcfe7b6a982c08ace Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Tue, 26 Dec 2023 17:38:10 +0900 Subject: [PATCH 3/7] =?UTF-8?q?[Chore]=20#229=20-=20cocoaPods=20=EC=97=85?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runnect-iOS/Podfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runnect-iOS/Podfile.lock b/Runnect-iOS/Podfile.lock index 327732e9..49d75367 100644 --- a/Runnect-iOS/Podfile.lock +++ b/Runnect-iOS/Podfile.lock @@ -118,4 +118,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: a1846e0d9fa164fc8d0a63bb343a6b7ba18187b9 -COCOAPODS: 1.12.1 +COCOAPODS: 1.14.3 From 15ddc618fac8f3740e228d4ffcc4ebb1d82f6e16 Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Tue, 26 Dec 2023 20:20:54 +0900 Subject: [PATCH 4/7] =?UTF-8?q?[Feat]=20#229=20-=20=EC=BD=94=EC=8A=A4=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EC=8A=A4=ED=81=AC=EB=9E=A9=20=EC=88=98=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=ED=95=98=EB=8A=94=20=EB=B6=80=EB=B6=84=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit API에서 스크랩 카운트를 주는 과정해서, UI 업데이트가 필요하였는데 그 부분을 변경하였습니다. --- .../Presentation/CourseDetail/VC/CourseDetailVC.swift | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index 814668c4..7b4e75d6 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -167,12 +167,8 @@ extension CourseDetailVC { guard let publicCourseId = publicCourseId else { return } scrapCourse(scrapTF: !sender.isSelected) - delegate?.didUpdateScrapState(publicCourseId: publicCourseId, isScrapped: !sender.isSelected) /// UI Update 부분 - - /// 누른상태(true)에서 누르면 스크랩 취소(false) 하는 이벤트, 즉 -1 -// let toggle = sender.isSelected ? -1 : 1 -// self.scrapCount += toggle - self.scrapCountLabel.text = "\(self.scrapCount)" + delegate?.didUpdateScrapState(publicCourseId: publicCourseId, isScrapped: !sender.isSelected) /// 코스 발견 UI Update 부분 + marathonDelegate?.didMarathonUpdateScrapState(publicCourseId: publicCourseId, isScrapped: !sender.isSelected) // 마라톤 코스 UI Update 부분 /// print("CourseDetailVC 스크랩 탭🔥publicCourseId=\(publicCourseId), isScrapped은 \(!sender.isSelected) 요렇게 변경 ") } @@ -581,6 +577,7 @@ extension CourseDetailVC { guard let data = responseDto.data else { return } self.likeButton.isSelected.toggle() self.scrapCount = data.scrapCount + self.scrapCountLabel.text = "\(self.scrapCount)" } catch { print(error.localizedDescription) } From d0abf38c50d4479bb5c2b1e240b77c93e417f53e Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Tue, 26 Dec 2023 20:21:43 +0900 Subject: [PATCH 5/7] =?UTF-8?q?[Chore]=20#229=20-=20=EB=B3=80=EC=88=98=20?= =?UTF-8?q?=EB=AA=85=EB=AA=85=20=EA=B7=9C=EC=B9=99=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/CourseDetail/VC/CourseDetailVC.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index 7b4e75d6..a4df630b 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -26,9 +26,7 @@ final class CourseDetailVC: UIViewController { weak var delegate: ScrapStateDelegate? private let scrapProvider = Providers.scrapProvider - - private let PublicCourseProvider = Providers.publicCourseProvider - + private let publicCourseProvider = Providers.publicCourseProvider private let courseProvider = Providers.courseProvider private var courseModel: Course? @@ -506,7 +504,7 @@ extension CourseDetailVC { private func getUploadedCourseDetail() { guard let publicCourseId = self.publicCourseId else { return } LoadingIndicator.showLoading() - PublicCourseProvider.request(.getUploadedCourseDetail(publicCourseId: publicCourseId)) { [weak self] response in + publicCourseProvider.request(.getUploadedCourseDetail(publicCourseId: publicCourseId)) { [weak self] response in guard let self = self else { return } LoadingIndicator.hideLoading() switch response { @@ -664,4 +662,3 @@ extension CourseDetailVC { } } } - From 9222aed70ad1e3eeea3e08f4facdded39f99f56f Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Tue, 26 Dec 2023 20:26:24 +0900 Subject: [PATCH 6/7] =?UTF-8?q?[Feat]=20#229=20-=20=EB=A7=88=EB=9D=BC?= =?UTF-8?q?=ED=86=A4=20Cell=EB=8F=84=20UI=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8=20=EB=90=98=EA=B2=8C=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 코스 상세 -> 코스 발견으로 나올때 마라톤 Cell도 추천 코스처럼 수정되게 기능을 구현 하였습니다. --- .../CourseDetail/VC/CourseDetailVC.swift | 4 +-- .../Views/MarathonMapCollectionViewCell.swift | 25 +++++++++++++++++++ .../Views/VC/CourseDiscoveryVC.swift | 1 + 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index a4df630b..e6ea6bf4 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -23,14 +23,14 @@ final class CourseDetailVC: UIViewController { // MARK: - Properties - weak var delegate: ScrapStateDelegate? + weak var delegate: ScrapStateDelegate? // 코스 발견 스크랩 이벤트 + weak var marathonDelegate: MarathonCourseDelegate? // 마라톤 스크랩 이벤트 private let scrapProvider = Providers.scrapProvider private let publicCourseProvider = Providers.publicCourseProvider private let courseProvider = Providers.courseProvider private var courseModel: Course? - private var uploadedCourseDetailModel: UploadedCourseDetailResponseDto? private var courseId: Int? diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift index cb43eb5a..f737e974 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift @@ -8,6 +8,10 @@ import UIKit import Combine +protocol MarathonCourseDelegate: AnyObject { + func didMarathonUpdateScrapState(publicCourseId: Int, isScrapped: Bool) +} + class CourseSelectionPublisher { static let shared = CourseSelectionPublisher() @@ -68,6 +72,15 @@ extension MarathonMapCollectionViewCell { marathonCollectionView.register(CourseListCVC.self, forCellWithReuseIdentifier: CourseListCVC.className) } + + private func marathonReloadCellForCourse(publicCourseId: Int) { + print("✅ 2. \(publicCourseId)번 부분이 교체가 되는가") + if let index = marathonCourseList.firstIndex(where: { $0.id == publicCourseId }) { + let indexPath = IndexPath(item: index, section: 0) + marathonCollectionView.reloadItems(at: [indexPath]) + print("✅ 3. \(indexPath) 마라톤 부분 스크랩 교체 되었음 \n reloadItems까지는 작동은 했음 여기서 안되면 코드가 잘 못 된것.") + } + } } // MARK: - Layout Helpers @@ -146,10 +159,22 @@ extension MarathonMapCollectionViewCell: CourseListCVCDeleagte { let publicCourseId = self.marathonCourseList[index].id self.scrapCourse(publicCourseId: publicCourseId, scrapTF: wantsTolike) + print("마라톤에 들어온 index = \(index)") } } +extension MarathonMapCollectionViewCell: MarathonCourseDelegate { + func didMarathonUpdateScrapState(publicCourseId: Int, isScrapped: Bool) { + print("✅ 1. 마라톤 델리게이트 들어오는가 🫶🏻") + if let index = marathonCourseList.firstIndex(where: { $0.id == publicCourseId }) { + marathonCourseList[index].scrap = isScrapped + marathonReloadCellForCourse(publicCourseId: publicCourseId) + print("✅ 4. ‼️MarathonMapCollectionViewCell에서 작업 완료") + } + } +} + // MARK: - NetWork extension MarathonMapCollectionViewCell { diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift index 9aff9953..874b132f 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift @@ -339,6 +339,7 @@ extension CourseDiscoveryVC: UICollectionViewDelegateFlowLayout { if let marathonCell = mapCollectionView.cellForItem(at: IndexPath(item: 0, section: Section.marathonCourseList)) as? MarathonMapCollectionViewCell { let marathonCourseList = marathonCell.marathonCourseList let courseDetailVC = CourseDetailVC() + courseDetailVC.marathonDelegate = marathonCell let courseModel = marathonCourseList[indexPath.item] courseDetailVC.setCourseId(courseId: courseModel.courseId, publicCourseId: courseModel.id) courseDetailVC.hidesBottomBarWhenPushed = true From feff49410b3aae9d72079cda04b96b5127f21269 Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Wed, 27 Dec 2023 15:00:38 +0900 Subject: [PATCH 7/7] =?UTF-8?q?[Chore]=20#229=20-=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=86=A0=EC=BD=9C=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/CourseDetail/VC/CourseDetailVC.swift | 4 ++-- .../Views/MarathonMapCollectionViewCell.swift | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index e6ea6bf4..9bad78c5 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -24,7 +24,7 @@ final class CourseDetailVC: UIViewController { // MARK: - Properties weak var delegate: ScrapStateDelegate? // 코스 발견 스크랩 이벤트 - weak var marathonDelegate: MarathonCourseDelegate? // 마라톤 스크랩 이벤트 + weak var marathonDelegate: MarathonScrapStateDelegate? // 마라톤 스크랩 이벤트 private let scrapProvider = Providers.scrapProvider private let publicCourseProvider = Providers.publicCourseProvider @@ -166,7 +166,7 @@ extension CourseDetailVC { scrapCourse(scrapTF: !sender.isSelected) delegate?.didUpdateScrapState(publicCourseId: publicCourseId, isScrapped: !sender.isSelected) /// 코스 발견 UI Update 부분 - marathonDelegate?.didMarathonUpdateScrapState(publicCourseId: publicCourseId, isScrapped: !sender.isSelected) // 마라톤 코스 UI Update 부분 + marathonDelegate?.didUpdateMarathonScrapState(publicCourseId: publicCourseId, isScrapped: !sender.isSelected) // 마라톤 코스 UI Update 부분 /// print("CourseDetailVC 스크랩 탭🔥publicCourseId=\(publicCourseId), isScrapped은 \(!sender.isSelected) 요렇게 변경 ") } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift index f737e974..e67307e3 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift @@ -8,8 +8,8 @@ import UIKit import Combine -protocol MarathonCourseDelegate: AnyObject { - func didMarathonUpdateScrapState(publicCourseId: Int, isScrapped: Bool) +protocol MarathonScrapStateDelegate: AnyObject { + func didUpdateMarathonScrapState(publicCourseId: Int, isScrapped: Bool) } class CourseSelectionPublisher { @@ -164,8 +164,8 @@ extension MarathonMapCollectionViewCell: CourseListCVCDeleagte { } } -extension MarathonMapCollectionViewCell: MarathonCourseDelegate { - func didMarathonUpdateScrapState(publicCourseId: Int, isScrapped: Bool) { +extension MarathonMapCollectionViewCell: MarathonScrapStateDelegate { + func didUpdateMarathonScrapState(publicCourseId: Int, isScrapped: Bool) { print("✅ 1. 마라톤 델리게이트 들어오는가 🫶🏻") if let index = marathonCourseList.firstIndex(where: { $0.id == publicCourseId }) { marathonCourseList[index].scrap = isScrapped