From f6769ed0bed9efdf6bc948329ef256f07f50d07a Mon Sep 17 00:00:00 2001 From: InTak Han Date: Wed, 19 Mar 2025 14:39:43 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[CHORE]=20#20=20=EB=B2=84=ED=8A=BC=EC=97=90?= =?UTF-8?q?=20=EA=B7=B8=EB=A6=BC=EC=9E=90=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Pinit/Pinit/Models/ProducerEntity.swift | 36 +++++++++---------- .../Views/Setting/SettingViewController.swift | 19 +++++----- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/Pinit/Pinit/Models/ProducerEntity.swift b/Pinit/Pinit/Models/ProducerEntity.swift index 7124cdf..e801e14 100644 --- a/Pinit/Pinit/Models/ProducerEntity.swift +++ b/Pinit/Pinit/Models/ProducerEntity.swift @@ -22,26 +22,26 @@ struct ProducerEntity { ProducerEntity( title: "JustHm", - latitude: 37.401848, - longitude: 126.922736, //본인 지역의 의,경도 - date: Date(), //생년월일 + latitude: 37.9244577, + longitude: 128.800009, //본인 지역의 의,경도 + date: Date(), //생년월일 1998.05.01 mediaPath: UIImage(named: "JustHMImg")!, - description: "나는 누구 입니다1", + description: "안녕하세요 ! 감자 개발자 안정흠입니다!",//istj weather: "구름"), ProducerEntity( title: "Ikhwan0204", - latitude: 37.502058, - longitude: 126.672010, //본인 지역의 의,경도 - date: Date(), //생년월일 + latitude: 37.506610, + longitude: 126.885332, //본인 지역의 의,경도 + date: Date(), //생년월일 2002.04.12 mediaPath: UIImage(named: "Ikhwan0204Img")!, - description: "나는 누구 입니다2", + description: "개발개바발 개발자 이규현입니다.ㅎㅎㅎ", //enfj weather: "흐림"), ProducerEntity( title: "IntakHan304", - latitude: 37.557385, - longitude: 126.956276, //본인 지역의 의,경도 + latitude: 37.434981, + longitude: 126.902328, //본인 지역의 의,경도 date: Date(), //생년월일 mediaPath: UIImage(named: "IntakHan304Img")!, description: "나는 누구 입니다3", @@ -49,20 +49,20 @@ struct ProducerEntity { ProducerEntity( title: "HISEHOONAN", - latitude: 38.078549, - longitude: 128.616008, //본인 지역의 의,경도 - date: Date(), //생년월일 + latitude: 37.508645, + longitude: 126.703513, //본인 지역의 의,경도 + date: Date(), //생년월일 1998.06.17 mediaPath: UIImage(named: "HISEHOONImg")! , - description: "나는 누구 입니다4", + description: "안녕하세요 ! 개발새발 개발자 안세훈입니다 !",//infp weather: "눈"), ProducerEntity( title: "kut7728", - latitude: 37.484679, - longitude: 126.897968, //본인 지역의 의,경도 - date: Date(), //생년월일 + latitude: 37.554267, + longitude: 126.953922, //본인 지역의 의,경도 + date: Date(), //생년월일 1998.03.02 mediaPath: UIImage(named: "kut7728Img")! , - description: "나는 누구 입니다5", + description: "네이티브 앱, 애플, 테크기기에 관심이 많은 앱 개발자(지망)입니다.", //infj weather: "맑음") ] } diff --git a/Pinit/Pinit/Views/Setting/SettingViewController.swift b/Pinit/Pinit/Views/Setting/SettingViewController.swift index e8582d2..d296a32 100644 --- a/Pinit/Pinit/Views/Setting/SettingViewController.swift +++ b/Pinit/Pinit/Views/Setting/SettingViewController.swift @@ -5,7 +5,6 @@ // Created by 안정흠 on 3/12/25. // - import UIKit final class SettingViewController: UIViewController { @@ -42,7 +41,15 @@ final class SettingViewController: UIViewController { //버튼 레이아웃 설정 resetButton.setTitle("전체 기록 삭제", for: .normal) resetButton.addTarget(self, action: #selector(resetAlert), for: .touchUpInside) - resetButton.backgroundColor = .lightGray + + resetButton.setTitleColor(.red, for: .normal) + + resetButton.backgroundColor = .white + resetButton.layer.cornerRadius = 10 + + resetButton.layer.masksToBounds = false + resetButton.layer.shadowOpacity = 0.5 + resetButton.layer.shadowOffset = CGSize(width: 0, height: 4) autoLayout() produceCollectionView.register(ProducerCollectionViewCell.self, forCellWithReuseIdentifier: "cell") @@ -89,14 +96,6 @@ extension SettingViewController : UICollectionViewDelegate, UICollectionViewDele return cell } - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - //컬렉션 뷰의 셀의 크기 - let itemSpacing : CGFloat = 10 - - let myWidth : CGFloat = (collectionView.bounds.width - itemSpacing * 2) / 2 - - return CGSize(width: myWidth, height: myWidth * 1.2) - } } //오토레이아웃 제약 설정(snapkit) 부분 From 00c8ef8e9c3f8cc0c33a1595795696bd5f3b02e0 Mon Sep 17 00:00:00 2001 From: InTak Han Date: Thu, 20 Mar 2025 09:50:19 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[CHORE]=20#20=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=EC=97=90=20=EC=83=9D=EC=9D=BC=EC=9D=B4=20=EC=A0=9C=EB=8C=80?= =?UTF-8?q?=EB=A1=9C=20=EB=82=98=EC=98=A4=EB=8F=84=EB=A1=9D=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 --- Pinit/Pinit/Models/ProducerEntity.swift | 12 ++++++------ .../Views/Setting/ProducerCollectionViewCell.swift | 12 +++++++----- .../Pinit/Views/Setting/SettingViewController.swift | 4 +++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Pinit/Pinit/Models/ProducerEntity.swift b/Pinit/Pinit/Models/ProducerEntity.swift index e801e14..3de0dc5 100644 --- a/Pinit/Pinit/Models/ProducerEntity.swift +++ b/Pinit/Pinit/Models/ProducerEntity.swift @@ -11,7 +11,7 @@ struct ProducerEntity { let title: String let latitude: Double let longitude: Double - let date: Date + let date: String let mediaPath: UIImage let description: String? let weather: String @@ -24,7 +24,7 @@ struct ProducerEntity { title: "JustHm", latitude: 37.9244577, longitude: 128.800009, //본인 지역의 의,경도 - date: Date(), //생년월일 1998.05.01 + date: "1998-05-01", //생년월일 mediaPath: UIImage(named: "JustHMImg")!, description: "안녕하세요 ! 감자 개발자 안정흠입니다!",//istj weather: "구름"), @@ -33,7 +33,7 @@ struct ProducerEntity { title: "Ikhwan0204", latitude: 37.506610, longitude: 126.885332, //본인 지역의 의,경도 - date: Date(), //생년월일 2002.04.12 + date: "2002-04-12", //생년월일 mediaPath: UIImage(named: "Ikhwan0204Img")!, description: "개발개바발 개발자 이규현입니다.ㅎㅎㅎ", //enfj weather: "흐림"), @@ -42,7 +42,7 @@ struct ProducerEntity { title: "IntakHan304", latitude: 37.434981, longitude: 126.902328, //본인 지역의 의,경도 - date: Date(), //생년월일 + date: "1991-03-04", //생년월일 mediaPath: UIImage(named: "IntakHan304Img")!, description: "나는 누구 입니다3", weather: "비"), @@ -51,7 +51,7 @@ struct ProducerEntity { title: "HISEHOONAN", latitude: 37.508645, longitude: 126.703513, //본인 지역의 의,경도 - date: Date(), //생년월일 1998.06.17 + date: "1998.06.17", //생년월일 mediaPath: UIImage(named: "HISEHOONImg")! , description: "안녕하세요 ! 개발새발 개발자 안세훈입니다 !",//infp weather: "눈"), @@ -60,7 +60,7 @@ struct ProducerEntity { title: "kut7728", latitude: 37.554267, longitude: 126.953922, //본인 지역의 의,경도 - date: Date(), //생년월일 1998.03.02 + date: "1998.03.02", //생년월일 mediaPath: UIImage(named: "kut7728Img")! , description: "네이티브 앱, 애플, 테크기기에 관심이 많은 앱 개발자(지망)입니다.", //infj weather: "맑음") diff --git a/Pinit/Pinit/Views/Setting/ProducerCollectionViewCell.swift b/Pinit/Pinit/Views/Setting/ProducerCollectionViewCell.swift index ce6afcf..26df849 100644 --- a/Pinit/Pinit/Views/Setting/ProducerCollectionViewCell.swift +++ b/Pinit/Pinit/Views/Setting/ProducerCollectionViewCell.swift @@ -42,12 +42,15 @@ class ProducerCollectionViewCell : UICollectionViewCell { }() func configure(model: ProducerEntity) { - dateLabel.text = model.date.snakeCaseDateString() + let myFormatter = DateFormatter() + myFormatter.dateFormat = "yyyy-MM-dd" // String의 문자열 형식과 동일 해야함 + + let birDate = myFormatter.date(from: model.date)! //생일 데이터를 불러온다 + + dateLabel.text = birDate.snakeCaseDateString() titleLabel.text = model.title - //thumbnailImageView.image = UIImage(systemName: "house") - //프로필에 지정한 이미지가 없다면 기본이미지로 집모양으로 들어간다 thumbnailImageView.image = model.mediaPath - //model.mediaPath ?? UIImage(systemName: "house") + cellSetting() } //모델(SettingView의 data)에서 데이터 가져오는 부분 @@ -74,7 +77,6 @@ class ProducerCollectionViewCell : UICollectionViewCell { contentView.addSubviews(thumbnailImageView, titleLabel, dateLabel) - //img.contentMode = .scaleToFill thumbnailImageView.snp.remakeConstraints { $0.top.leading.trailing.equalToSuperview().inset(8) $0.height.equalTo(contentView.frame.width * 0.76) diff --git a/Pinit/Pinit/Views/Setting/SettingViewController.swift b/Pinit/Pinit/Views/Setting/SettingViewController.swift index d296a32..9d91cd0 100644 --- a/Pinit/Pinit/Views/Setting/SettingViewController.swift +++ b/Pinit/Pinit/Views/Setting/SettingViewController.swift @@ -40,6 +40,7 @@ final class SettingViewController: UIViewController { //버튼 레이아웃 설정 resetButton.setTitle("전체 기록 삭제", for: .normal) + resetButton.titleLabel?.font = DesignSystemFont.Pretendard_Medium18.value resetButton.addTarget(self, action: #selector(resetAlert), for: .touchUpInside) resetButton.setTitleColor(.red, for: .normal) @@ -77,7 +78,8 @@ final class SettingViewController: UIViewController { extension SettingViewController : UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - let detailVC = PinDetailViewController() + let detailVC = PinDetailViewController() //프로필 누르면 상세 화면으로 + present(detailVC, animated: true ,completion: nil ) } From ee651e910dbfdcd616d3378c427e447c9645ca82 Mon Sep 17 00:00:00 2001 From: InTak Han Date: Thu, 20 Mar 2025 11:44:29 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[CHORE]=20#20=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EB=B0=8F=20Entity=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Pinit/Pinit/Models/ProducerEntity.swift | 98 +++++++++++-------- .../Setting/ProducerCollectionViewCell.swift | 10 +- .../Views/Setting/SettingViewController.swift | 23 ++--- 3 files changed, 74 insertions(+), 57 deletions(-) diff --git a/Pinit/Pinit/Models/ProducerEntity.swift b/Pinit/Pinit/Models/ProducerEntity.swift index 3de0dc5..ee98527 100644 --- a/Pinit/Pinit/Models/ProducerEntity.swift +++ b/Pinit/Pinit/Models/ProducerEntity.swift @@ -6,63 +6,83 @@ // import UIKit -struct ProducerEntity { - //이름, 위,경도(지역), 생일, 각자사진, 소개, 문구, 기분(날씨) - let title: String - let latitude: Double - let longitude: Double - let date: String - let mediaPath: UIImage - let description: String? - let weather: String +extension PinEntity { + + private static func toDate(_ dateString: String)-> Date { + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "yyyy-MM-dd" + dateFormatter.timeZone = TimeZone.current // 현재 시간대 사용 + dateFormatter.locale = Locale(identifier: "ko_KR") // 한국 로캘 설정 (선택사항) + + if let date = dateFormatter.date(from: dateString) { + return date + }else{ + return Date() + } + } - static let sampleData: [ProducerEntity] = [ + static let producerData: [PinEntity] = [ //데이터 부분들 - ProducerEntity( + PinEntity( + pin_id: UUID(), title: "JustHm", latitude: 37.9244577, - longitude: 128.800009, //본인 지역의 의,경도 - date: "1998-05-01", //생년월일 - mediaPath: UIImage(named: "JustHMImg")!, - description: "안녕하세요 ! 감자 개발자 안정흠입니다!",//istj - weather: "구름"), + longitude: 128.800009,//본인 지역의 의,경도 + address: "", + date: toDate("1998-05-01"), //생년월일 + weather: "istj", + description: "안녕하세요 ! 감자 개발자 안정흠입니다!", + mediaPath: UIImage(named: "JustHMImg")! + ), - ProducerEntity( + PinEntity( + pin_id: UUID(), title: "Ikhwan0204", latitude: 37.506610, - longitude: 126.885332, //본인 지역의 의,경도 - date: "2002-04-12", //생년월일 - mediaPath: UIImage(named: "Ikhwan0204Img")!, - description: "개발개바발 개발자 이규현입니다.ㅎㅎㅎ", //enfj - weather: "흐림"), + longitude: 126.885332, + address: "", + date: toDate("2002-04-12"), + weather: "enfj", + description: "개발개바발 개발자 이규현입니다.ㅎㅎㅎ", + mediaPath: UIImage(named: "Ikhwan0204Img")! + ), - ProducerEntity( + PinEntity( + pin_id: UUID(), title: "IntakHan304", latitude: 37.434981, - longitude: 126.902328, //본인 지역의 의,경도 - date: "1991-03-04", //생년월일 - mediaPath: UIImage(named: "IntakHan304Img")!, - description: "나는 누구 입니다3", - weather: "비"), + longitude: 126.902328, + address: "", + date: toDate("1991-03-04"), + weather: "infj" , + description: "처음 시작하는 개발자 한인탁 입니다.", + mediaPath: UIImage(named: "IntakHan304Img")! + ), - ProducerEntity( + PinEntity( + pin_id: UUID(), title: "HISEHOONAN", latitude: 37.508645, - longitude: 126.703513, //본인 지역의 의,경도 - date: "1998.06.17", //생년월일 - mediaPath: UIImage(named: "HISEHOONImg")! , - description: "안녕하세요 ! 개발새발 개발자 안세훈입니다 !",//infp - weather: "눈"), + longitude: 126.703513, + address: "", + date: toDate("1999.06.17"), + weather: "infp", + description: "안녕하세요 ! 개발새발 개발자 안세훈입니다 ! ", + mediaPath: UIImage(named: "HISEHOONImg")! + ), - ProducerEntity( + PinEntity( + pin_id: UUID(), title: "kut7728", latitude: 37.554267, longitude: 126.953922, //본인 지역의 의,경도 - date: "1998.03.02", //생년월일 - mediaPath: UIImage(named: "kut7728Img")! , - description: "네이티브 앱, 애플, 테크기기에 관심이 많은 앱 개발자(지망)입니다.", //infj - weather: "맑음") + address: "", + date: toDate("1998.03.02"), //생년월일 + weather: "intj", + description: "네이티브 앱, 애플, 테크기기에 관심이 많은 앱 개발자(지망)입니다.", // + mediaPath: UIImage(named: "kut7728Img")! + ) ] } diff --git a/Pinit/Pinit/Views/Setting/ProducerCollectionViewCell.swift b/Pinit/Pinit/Views/Setting/ProducerCollectionViewCell.swift index 26df849..7e48ab3 100644 --- a/Pinit/Pinit/Views/Setting/ProducerCollectionViewCell.swift +++ b/Pinit/Pinit/Views/Setting/ProducerCollectionViewCell.swift @@ -41,13 +41,9 @@ class ProducerCollectionViewCell : UICollectionViewCell { return label }() - func configure(model: ProducerEntity) { - let myFormatter = DateFormatter() - myFormatter.dateFormat = "yyyy-MM-dd" // String의 문자열 형식과 동일 해야함 - - let birDate = myFormatter.date(from: model.date)! //생일 데이터를 불러온다 - - dateLabel.text = birDate.snakeCaseDateString() + func configure(model: PinEntity) { + + dateLabel.text = model.date.snakeCaseDateString() titleLabel.text = model.title thumbnailImageView.image = model.mediaPath diff --git a/Pinit/Pinit/Views/Setting/SettingViewController.swift b/Pinit/Pinit/Views/Setting/SettingViewController.swift index 9d91cd0..cb300e7 100644 --- a/Pinit/Pinit/Views/Setting/SettingViewController.swift +++ b/Pinit/Pinit/Views/Setting/SettingViewController.swift @@ -8,7 +8,7 @@ import UIKit final class SettingViewController: UIViewController { - var data: [ProducerEntity] = ProducerEntity.sampleData + var data: [PinEntity] = PinEntity.producerData //모델에서 데이터를 가져옴 private let resetButton = UIButton() @@ -43,14 +43,14 @@ final class SettingViewController: UIViewController { resetButton.titleLabel?.font = DesignSystemFont.Pretendard_Medium18.value resetButton.addTarget(self, action: #selector(resetAlert), for: .touchUpInside) - resetButton.setTitleColor(.red, for: .normal) + resetButton.setTitleColor(.white, for: .normal) - resetButton.backgroundColor = .white + resetButton.backgroundColor = .red resetButton.layer.cornerRadius = 10 resetButton.layer.masksToBounds = false - resetButton.layer.shadowOpacity = 0.5 - resetButton.layer.shadowOffset = CGSize(width: 0, height: 4) + //resetButton.layer.shadowOpacity = 0.5 + //resetButton.layer.shadowOffset = CGSize(width: 0, height: 4) autoLayout() produceCollectionView.register(ProducerCollectionViewCell.self, forCellWithReuseIdentifier: "cell") @@ -104,15 +104,16 @@ extension SettingViewController : UICollectionViewDelegate, UICollectionViewDele extension SettingViewController { private func autoLayout() { resetButton.snp.makeConstraints { - $0.centerX.equalToSuperview() - $0.bottom.equalToSuperview().offset(-90) - $0.height.equalTo(50) - $0.leading.equalTo(10) + $0.bottom.equalTo(view.safeAreaLayoutGuide) + $0.height.equalTo(70) + $0.leading.equalToSuperview().inset(10) + $0.trailing.equalToSuperview().offset(-10) } //컬렉션 뷰 제약 설정 부분 예정 produceCollectionView.snp.makeConstraints { - $0.edges.equalTo(view.safeAreaLayoutGuide) - $0.bottom.equalTo(resetButton.snp.top).offset(-30) + $0.top.equalTo(view.safeAreaLayoutGuide).inset(10) + $0.width.equalToSuperview() + $0.bottom.equalTo(resetButton.snp.top) } } }