From 2d116553c5a082a23aadd1883a59e9bf5d433c8e Mon Sep 17 00:00:00 2001 From: doyeonk429 <80318425+doyeonk429@users.noreply.github.com> Date: Sat, 17 Aug 2024 15:52:29 +0900 Subject: [PATCH] =?UTF-8?q?#42=20=EC=B7=A8=ED=96=A5=EC=B0=BE=EA=B8=B0=20re?= =?UTF-8?q?quest=20=EC=98=81=EC=96=B4=EB=A1=9C=20=EB=B3=B4=EB=82=B4?= =?UTF-8?q?=EA=B8=B0=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VCs/TasteTest/TasteTestFirstCollectionViewCell.swift | 4 +++- .../VCs/TasteTest/TasteTestSecondCollectionViewCell.swift | 4 +++- .../VCs/TasteTest/ThirdKindTasteTestViewController.swift | 8 +++++--- .../TasteTest/ThirdNationTasteTestViewController.swift | 7 ++++--- .../TasteTest/ThirdVarietyTasteTestViewController.swift | 1 + 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Drink-EG/Drink-EG/Sources/VCs/TasteTest/TasteTestFirstCollectionViewCell.swift b/Drink-EG/Drink-EG/Sources/VCs/TasteTest/TasteTestFirstCollectionViewCell.swift index e61e454..934ff3a 100644 --- a/Drink-EG/Drink-EG/Sources/VCs/TasteTest/TasteTestFirstCollectionViewCell.swift +++ b/Drink-EG/Drink-EG/Sources/VCs/TasteTest/TasteTestFirstCollectionViewCell.swift @@ -8,6 +8,7 @@ import UIKit class TasteTestFirstCollectionViewCell: UICollectionViewCell { + var kindEngName : String = "" let imageView: UIImageView = { let iv = UIImageView() iv.layer.cornerRadius = 10 @@ -52,10 +53,11 @@ class TasteTestFirstCollectionViewCell: UICollectionViewCell { } } - func configure(imageName: String) { + func configure(imageName: String, kindName : String) { if let image = UIImage(named: imageName) { self.name.text = imageName imageView.image = image + self.kindEngName = kindName } } } diff --git a/Drink-EG/Drink-EG/Sources/VCs/TasteTest/TasteTestSecondCollectionViewCell.swift b/Drink-EG/Drink-EG/Sources/VCs/TasteTest/TasteTestSecondCollectionViewCell.swift index 9d6444e..4bfd4b1 100644 --- a/Drink-EG/Drink-EG/Sources/VCs/TasteTest/TasteTestSecondCollectionViewCell.swift +++ b/Drink-EG/Drink-EG/Sources/VCs/TasteTest/TasteTestSecondCollectionViewCell.swift @@ -8,6 +8,7 @@ import UIKit class TasteTestSecondCollectionViewCell: UICollectionViewCell { + var nationEngName : String = "" let View: UIView = { let v = UIView() @@ -65,7 +66,7 @@ class TasteTestSecondCollectionViewCell: UICollectionViewCell { } } - func configure(imageName: String) { + func configure(imageName: String, nationName: String) { if let image = UIImage(named: imageName) { if (imageName == "기타1") { self.name.text = "기타" @@ -73,6 +74,7 @@ class TasteTestSecondCollectionViewCell: UICollectionViewCell { self.name.text = imageName } imageView.image = image + self.nationEngName = nationName } } } diff --git a/Drink-EG/Drink-EG/Sources/VCs/TasteTest/ThirdKindTasteTestViewController.swift b/Drink-EG/Drink-EG/Sources/VCs/TasteTest/ThirdKindTasteTestViewController.swift index d210fd1..0441b2a 100644 --- a/Drink-EG/Drink-EG/Sources/VCs/TasteTest/ThirdKindTasteTestViewController.swift +++ b/Drink-EG/Drink-EG/Sources/VCs/TasteTest/ThirdKindTasteTestViewController.swift @@ -10,6 +10,7 @@ import UIKit class ThirdKindTasteTestViewController: UIViewController { var kind: [String] = ["레드", "화이트", "스파클링", "로제", "주정강화", "네츄럴", "기타"] + var kindEng : [String] = ["Red", "White", "Sparkling", "Rose", "Port", "Natural", "etc"] var selectedIndexPaths: [IndexPath] = [] var selectedWineName : [String] = [] @@ -149,7 +150,7 @@ extension ThirdKindTasteTestViewController: UICollectionViewDataSource, UICollec let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "TasteTestFirstCollectionViewCell", for: indexPath) as! TasteTestFirstCollectionViewCell - cell.configure(imageName: kind[indexPath.item]) + cell.configure(imageName: kind[indexPath.item], kindName: kindEng[indexPath.item]) return cell } @@ -162,8 +163,9 @@ extension ThirdKindTasteTestViewController: UICollectionViewDataSource, UICollec cell.imageView.layer.borderWidth = 4 // 테두리 두께 설정 // 선택된 셀의 indexPath를 배열에 추가 + selectedIndexPaths.append(indexPath) - selectedWineName.append(cell.name.text ?? "") + selectedWineName.append(cell.kindEngName) } else { // 셀이 이미 선택된 상태였을 때 (다시 클릭하면 원래대로) cell.imageView.layer.borderWidth = 0 @@ -173,7 +175,7 @@ extension ThirdKindTasteTestViewController: UICollectionViewDataSource, UICollec selectedIndexPaths.remove(at: index) } - selectedWineName = selectedWineName.filter{$0 != (cell.name.text ?? "")} + selectedWineName = selectedWineName.filter{$0 != (cell.kindEngName)} } // nextButton의 상태 업데이트 diff --git a/Drink-EG/Drink-EG/Sources/VCs/TasteTest/ThirdNationTasteTestViewController.swift b/Drink-EG/Drink-EG/Sources/VCs/TasteTest/ThirdNationTasteTestViewController.swift index 85ceb48..d5d1e9c 100644 --- a/Drink-EG/Drink-EG/Sources/VCs/TasteTest/ThirdNationTasteTestViewController.swift +++ b/Drink-EG/Drink-EG/Sources/VCs/TasteTest/ThirdNationTasteTestViewController.swift @@ -10,6 +10,7 @@ import UIKit class ThirdNationTasteTestViewController: UIViewController { var nation: [String] = ["프랑스", "이탈리아", "미국", "칠레", "스페인", "호주", "아르헨티나", "독일", "뉴질랜드", "포르투갈", "오스트리아", "그리스", "슬로베니아", "헝가리", "캐나다", "대한민국", "기타1"] + var nationEng: [String] = ["France", "Italy", "United States", "Chile", "Spain", "Australia", "Argentina", "Germany", "New Zealand", "Portugal", "Austria", "Greece", "Slovenia", "Hungary", "Canada", "South Korea", "Other"] var selectedIndexPaths: [IndexPath] = [] private var selectedNations : [String] = [] @@ -148,7 +149,7 @@ extension ThirdNationTasteTestViewController: UICollectionViewDataSource, UIColl let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "TasteTestSecondCollectionViewCell", for: indexPath) as! TasteTestSecondCollectionViewCell - cell.configure(imageName: nation[indexPath.item]) + cell.configure(imageName: nation[indexPath.item], nationName: nationEng[indexPath.item]) return cell } @@ -162,7 +163,7 @@ extension ThirdNationTasteTestViewController: UICollectionViewDataSource, UIColl // 선택된 셀의 indexPath를 배열에 추가 selectedIndexPaths.append(indexPath) - selectedNations.append(cell.name.text ?? "") + selectedNations.append(cell.nationEngName) } else { // 셀이 이미 선택된 상태였을 때 (다시 클릭하면 원래대로) @@ -173,7 +174,7 @@ extension ThirdNationTasteTestViewController: UICollectionViewDataSource, UIColl selectedIndexPaths.remove(at: index) } - selectedNations = selectedNations.filter{$0 != (cell.name.text ?? "")} + selectedNations = selectedNations.filter{$0 != (cell.nationEngName)} } // nextButton의 상태 업데이트 diff --git a/Drink-EG/Drink-EG/Sources/VCs/TasteTest/ThirdVarietyTasteTestViewController.swift b/Drink-EG/Drink-EG/Sources/VCs/TasteTest/ThirdVarietyTasteTestViewController.swift index dcd650b..293fefb 100644 --- a/Drink-EG/Drink-EG/Sources/VCs/TasteTest/ThirdVarietyTasteTestViewController.swift +++ b/Drink-EG/Drink-EG/Sources/VCs/TasteTest/ThirdVarietyTasteTestViewController.swift @@ -167,6 +167,7 @@ class ThirdVarietyTasteTestViewController: UIViewController { func callAPI(completion: @escaping (Bool) -> Void) { if let data = self.memberInfoDTO { provider.request(.patchMember(data: data)) { result in + print(data) switch result { case .success(let response): do {