Skip to content

Commit ecf957b

Browse files
committed
[Refactor] 리팩토링
1 parent ca2b3db commit ecf957b

4 files changed

Lines changed: 22 additions & 13 deletions

File tree

MarketPlace.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,7 @@
13021302
CODE_SIGN_STYLE = Automatic;
13031303
CURRENT_PROJECT_VERSION = 1;
13041304
DEVELOPMENT_ASSET_PATHS = "\"MarketPlace/Preview Content\"";
1305-
DEVELOPMENT_TEAM = 7RR74CRWQW;
1305+
DEVELOPMENT_TEAM = F7GYZYWC6V;
13061306
ENABLE_PREVIEWS = YES;
13071307
GENERATE_INFOPLIST_FILE = YES;
13081308
INFOPLIST_FILE = MarketPlace/Info.plist;
@@ -1334,7 +1334,7 @@
13341334
CODE_SIGN_STYLE = Automatic;
13351335
CURRENT_PROJECT_VERSION = 1;
13361336
DEVELOPMENT_ASSET_PATHS = "\"MarketPlace/Preview Content\"";
1337-
DEVELOPMENT_TEAM = 7RR74CRWQW;
1337+
DEVELOPMENT_TEAM = F7GYZYWC6V;
13381338
ENABLE_PREVIEWS = YES;
13391339
GENERATE_INFOPLIST_FILE = YES;
13401340
INFOPLIST_FILE = MarketPlace/Info.plist;

MarketPlace/Model/CheerMarketModel.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import Foundation
2+
13
struct CheerMarketModel: Codable, Identifiable {
24
let marketId: Int
35
let marketName: String
@@ -8,4 +10,14 @@ struct CheerMarketModel: Codable, Identifiable {
810
var dueDate: Int?
911

1012
var id: Int { marketId }
13+
14+
var dueDateFormmater: Int {
15+
guard let dueDate = dueDate else { return 0 }
16+
return dueDate
17+
}
18+
19+
var cheerCountFormatter: Int {
20+
guard let cheerCount = cheerCount else { return 0 }
21+
return cheerCount
22+
}
1123
}

MarketPlace/View/Cheer/Components/CheerCardCell.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
import SwiftUI
23

34
struct CheerCardCell: View {
@@ -19,18 +20,18 @@ struct CheerCardCell: View {
1920
Text("마감까지")
2021
.foregroundColor(Color(hex: "#A0A0A2"))
2122

22-
Text("\(viewModel.cheerMarket.dueDate)일 남음")
23+
Text("\(viewModel.cheerMarket.dueDateFormmater)일 남음")
2324
.foregroundColor(Color(hex: "#545454"))
2425
}
2526
.pretendardFont(size: 12, weight: .medium)
2627

2728
Spacer()
2829

29-
Text("\(viewModel.cheerMarket.cheerCount)")
30+
Text("\(viewModel.cheerMarket.cheerCountFormatter)")
3031
.pretendardFont(size: 12, weight: .regular)
3132
.foregroundColor(.gray)
3233
Image(systemName: viewModel.isCheer ? "heart.fill" : "heart")
33-
.foregroundColor(viewModel.isCheer ? .red : .gray)
34+
.foregroundColor(.gray)
3435
}
3536

3637
Button(action: {

MarketPlace/View/Search/Component/PopularityBenefitView.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ struct BookmarkButton: View {
3838
// 혜택 카드 컴포넌트
3939
struct BenefitCard: View {
4040
let benefit: CouponTopModel
41-
@Binding var isBookmarked: Bool
4241

4342
var body: some View {
4443
VStack(alignment: .leading, spacing: 10) {
@@ -50,8 +49,6 @@ struct BenefitCard: View {
5049
width: BenefitViewConstants.Layout.cardWidth,
5150
height: BenefitViewConstants.Layout.cardWidth
5251
)
53-
54-
BookmarkButton(isBookmarked: $isBookmarked)
5552
}
5653

5754
VStack(alignment: .leading, spacing: 4){
@@ -72,24 +69,23 @@ struct BenefitCard: View {
7269

7370
struct PopularBenefitView: View {
7471
@Binding var popularCoupon: [CouponTopModel]
75-
@State private var isBookmarked: Bool = false
7672

7773
var body: some View {
7874
VStack(alignment: .leading, spacing: 20) {
7975
Text("인기 혜택")
8076
.pretendardFont(size: BenefitViewConstants.Font.titleSize, weight: .bold)
8177
.foregroundColor(.black)
78+
.padding(.leading, 20)
8279

8380
ScrollView(.horizontal, showsIndicators: false) {
8481
HStack(spacing: BenefitViewConstants.Layout.spacing) {
8582
ForEach(popularCoupon) { coupon in
8683
BenefitCard(
87-
benefit: coupon,
88-
isBookmarked: $isBookmarked)
84+
benefit: coupon
85+
)
8986
}
90-
}
87+
}.padding(.leading, 20)
9188
}
9289
}
93-
.padding(.leading, 20)
9490
}
9591
}

0 commit comments

Comments
 (0)