Skip to content

Commit 00c8ef8

Browse files
committed
[CHORE] #20 프로필에 생일이 제대로 나오도록 수정
1 parent f6769ed commit 00c8ef8

3 files changed

Lines changed: 16 additions & 12 deletions

File tree

Pinit/Pinit/Models/ProducerEntity.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct ProducerEntity {
1111
let title: String
1212
let latitude: Double
1313
let longitude: Double
14-
let date: Date
14+
let date: String
1515
let mediaPath: UIImage
1616
let description: String?
1717
let weather: String
@@ -24,7 +24,7 @@ struct ProducerEntity {
2424
title: "JustHm",
2525
latitude: 37.9244577,
2626
longitude: 128.800009, //본인 지역의 의,경도
27-
date: Date(), //생년월일 1998.05.01
27+
date: "1998-05-01", //생년월일
2828
mediaPath: UIImage(named: "JustHMImg")!,
2929
description: "안녕하세요 ! 감자 개발자 안정흠입니다!",//istj
3030
weather: "구름"),
@@ -33,7 +33,7 @@ struct ProducerEntity {
3333
title: "Ikhwan0204",
3434
latitude: 37.506610,
3535
longitude: 126.885332, //본인 지역의 의,경도
36-
date: Date(), //생년월일 2002.04.12
36+
date: "2002-04-12", //생년월일
3737
mediaPath: UIImage(named: "Ikhwan0204Img")!,
3838
description: "개발개바발 개발자 이규현입니다.ㅎㅎㅎ", //enfj
3939
weather: "흐림"),
@@ -42,7 +42,7 @@ struct ProducerEntity {
4242
title: "IntakHan304",
4343
latitude: 37.434981,
4444
longitude: 126.902328, //본인 지역의 의,경도
45-
date: Date(), //생년월일
45+
date: "1991-03-04", //생년월일
4646
mediaPath: UIImage(named: "IntakHan304Img")!,
4747
description: "나는 누구 입니다3",
4848
weather: ""),
@@ -51,7 +51,7 @@ struct ProducerEntity {
5151
title: "HISEHOONAN",
5252
latitude: 37.508645,
5353
longitude: 126.703513, //본인 지역의 의,경도
54-
date: Date(), //생년월일 1998.06.17
54+
date: "1998.06.17", //생년월일
5555
mediaPath: UIImage(named: "HISEHOONImg")! ,
5656
description: "안녕하세요 ! 개발새발 개발자 안세훈입니다 !",//infp
5757
weather: ""),
@@ -60,7 +60,7 @@ struct ProducerEntity {
6060
title: "kut7728",
6161
latitude: 37.554267,
6262
longitude: 126.953922, //본인 지역의 의,경도
63-
date: Date(), //생년월일 1998.03.02
63+
date: "1998.03.02", //생년월일
6464
mediaPath: UIImage(named: "kut7728Img")! ,
6565
description: "네이티브 앱, 애플, 테크기기에 관심이 많은 앱 개발자(지망)입니다.", //infj
6666
weather: "맑음")

Pinit/Pinit/Views/Setting/ProducerCollectionViewCell.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,15 @@ class ProducerCollectionViewCell : UICollectionViewCell {
4242
}()
4343

4444
func configure(model: ProducerEntity) {
45-
dateLabel.text = model.date.snakeCaseDateString()
45+
let myFormatter = DateFormatter()
46+
myFormatter.dateFormat = "yyyy-MM-dd" // String의 문자열 형식과 동일 해야함
47+
48+
let birDate = myFormatter.date(from: model.date)! //생일 데이터를 불러온다
49+
50+
dateLabel.text = birDate.snakeCaseDateString()
4651
titleLabel.text = model.title
47-
//thumbnailImageView.image = UIImage(systemName: "house")
48-
//프로필에 지정한 이미지가 없다면 기본이미지로 집모양으로 들어간다
4952
thumbnailImageView.image = model.mediaPath
50-
//model.mediaPath ?? UIImage(systemName: "house")
53+
5154
cellSetting()
5255
} //모델(SettingView의 data)에서 데이터 가져오는 부분
5356

@@ -74,7 +77,6 @@ class ProducerCollectionViewCell : UICollectionViewCell {
7477

7578
contentView.addSubviews(thumbnailImageView, titleLabel, dateLabel)
7679

77-
//img.contentMode = .scaleToFill
7880
thumbnailImageView.snp.remakeConstraints {
7981
$0.top.leading.trailing.equalToSuperview().inset(8)
8082
$0.height.equalTo(contentView.frame.width * 0.76)

Pinit/Pinit/Views/Setting/SettingViewController.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ final class SettingViewController: UIViewController {
4040

4141
//버튼 레이아웃 설정
4242
resetButton.setTitle("전체 기록 삭제", for: .normal)
43+
resetButton.titleLabel?.font = DesignSystemFont.Pretendard_Medium18.value
4344
resetButton.addTarget(self, action: #selector(resetAlert), for: .touchUpInside)
4445

4546
resetButton.setTitleColor(.red, for: .normal)
@@ -77,7 +78,8 @@ final class SettingViewController: UIViewController {
7778
extension SettingViewController : UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
7879

7980
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
80-
let detailVC = PinDetailViewController()
81+
let detailVC = PinDetailViewController() //프로필 누르면 상세 화면으로
82+
8183
present(detailVC, animated: true ,completion: nil )
8284
}
8385

0 commit comments

Comments
 (0)