Skip to content

Commit bca4b9a

Browse files
committed
✨[feat]: 상세 뷰 사진 가져오기 #22
1 parent 3dd6fa7 commit bca4b9a

File tree

7 files changed

+176
-100
lines changed

7 files changed

+176
-100
lines changed

MarketApp/MarketApp.xcodeproj/project.pbxproj

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
7FF4DA192995192200AC04D7 /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FF4DA182995192200AC04D7 /* SearchView.swift */; };
101101
C9A7B73D294353290051E644 /* mockData.json in Resources */ = {isa = PBXBuildFile; fileRef = C9A7B73C294353290051E644 /* mockData.json */; };
102102
D3BAB82DFC4CADBC9DF5A1CE /* Pods_MarketAppTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 78AB0C99A0B06EDFEE1C4A1C /* Pods_MarketAppTests.framework */; };
103-
EC451F6E290BBCD7008C88A7 /* InfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC451F6D290BBCD7008C88A7 /* InfoView.swift */; };
103+
EC451F6E290BBCD7008C88A7 /* DetailImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC451F6D290BBCD7008C88A7 /* DetailImageView.swift */; };
104104
EC892A9F2908189600D02F99 /* MarketAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC892A9E2908189600D02F99 /* MarketAppApp.swift */; };
105105
EC892AA12908189600D02F99 /* MainTabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC892AA02908189600D02F99 /* MainTabView.swift */; };
106106
EC892AA32908189700D02F99 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EC892AA22908189700D02F99 /* Assets.xcassets */; };
@@ -233,7 +233,7 @@
233233
B8B1F400B0E00C4FA897EBD2 /* Pods-MarketApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MarketApp.release.xcconfig"; path = "Target Support Files/Pods-MarketApp/Pods-MarketApp.release.xcconfig"; sourceTree = "<group>"; };
234234
C9A7B73C294353290051E644 /* mockData.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = mockData.json; sourceTree = "<group>"; };
235235
DAE05443C070FD4D365EBE21 /* Pods-MarketApp-MarketAppUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MarketApp-MarketAppUITests.debug.xcconfig"; path = "Target Support Files/Pods-MarketApp-MarketAppUITests/Pods-MarketApp-MarketAppUITests.debug.xcconfig"; sourceTree = "<group>"; };
236-
EC451F6D290BBCD7008C88A7 /* InfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoView.swift; sourceTree = "<group>"; };
236+
EC451F6D290BBCD7008C88A7 /* DetailImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailImageView.swift; sourceTree = "<group>"; };
237237
EC892A9B2908189600D02F99 /* MarketApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MarketApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
238238
EC892A9E2908189600D02F99 /* MarketAppApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketAppApp.swift; sourceTree = "<group>"; };
239239
EC892AA02908189600D02F99 /* MainTabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabView.swift; sourceTree = "<group>"; };
@@ -804,7 +804,7 @@
804804
EC892ABE2908214900D02F99 /* ProductView.swift */,
805805
ECB2F1352909258B00E9F7D3 /* PopView.swift */,
806806
7F3E17C4299C6DF80095BB2F /* InfoViewModel.swift */,
807-
EC451F6D290BBCD7008C88A7 /* InfoView.swift */,
807+
EC451F6D290BBCD7008C88A7 /* DetailImageView.swift */,
808808
ECF5BE452914D01E0052655B /* ReviewView.swift */,
809809
7F40E25F29C6F01800EC8AB6 /* ProductInfoImage.swift */,
810810
);
@@ -1255,7 +1255,7 @@
12551255
7FF4DA192995192200AC04D7 /* SearchView.swift in Sources */,
12561256
7F0F1661296EF0B400FB4C30 /* SignManger.swift in Sources */,
12571257
7F0F164929600AEF00FB4C30 /* CustomInputField.swift in Sources */,
1258-
EC451F6E290BBCD7008C88A7 /* InfoView.swift in Sources */,
1258+
EC451F6E290BBCD7008C88A7 /* DetailImageView.swift in Sources */,
12591259
7F0F163E2960033F00FB4C30 /* LoginView.swift in Sources */,
12601260
7F6037AB297AB5FA0034CFF7 /* SignUPNickNameView.swift in Sources */,
12611261
7F4B9627298D1758006AAF48 /* AppLifeCycleModifier.swift in Sources */,
@@ -1327,7 +1327,7 @@
13271327
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
13281328
CODE_SIGN_IDENTITY = "Apple Development";
13291329
CODE_SIGN_STYLE = Automatic;
1330-
CURRENT_PROJECT_VERSION = 51;
1330+
CURRENT_PROJECT_VERSION = 52;
13311331
DEBUG_INFORMATION_FORMAT = dwarf;
13321332
DEVELOPMENT_TEAM = N94CS4N6VR;
13331333
GENERATE_INFOPLIST_FILE = YES;
@@ -1354,7 +1354,7 @@
13541354
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
13551355
CODE_SIGN_IDENTITY = "Apple Development";
13561356
CODE_SIGN_STYLE = Automatic;
1357-
CURRENT_PROJECT_VERSION = 51;
1357+
CURRENT_PROJECT_VERSION = 52;
13581358
DEVELOPMENT_TEAM = N94CS4N6VR;
13591359
GENERATE_INFOPLIST_FILE = YES;
13601360
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
@@ -1379,7 +1379,7 @@
13791379
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
13801380
CODE_SIGN_IDENTITY = "Apple Development";
13811381
CODE_SIGN_STYLE = Automatic;
1382-
CURRENT_PROJECT_VERSION = 51;
1382+
CURRENT_PROJECT_VERSION = 52;
13831383
DEBUG_INFORMATION_FORMAT = dwarf;
13841384
DEVELOPMENT_TEAM = N94CS4N6VR;
13851385
GENERATE_INFOPLIST_FILE = YES;
@@ -1405,7 +1405,7 @@
14051405
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
14061406
CODE_SIGN_IDENTITY = "Apple Development";
14071407
CODE_SIGN_STYLE = Automatic;
1408-
CURRENT_PROJECT_VERSION = 51;
1408+
CURRENT_PROJECT_VERSION = 52;
14091409
DEVELOPMENT_TEAM = N94CS4N6VR;
14101410
GENERATE_INFOPLIST_FILE = YES;
14111411
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
@@ -1550,7 +1550,7 @@
15501550
CODE_SIGN_ENTITLEMENTS = MarketApp/MarketApp.entitlements;
15511551
CODE_SIGN_IDENTITY = "Apple Development";
15521552
CODE_SIGN_STYLE = Automatic;
1553-
CURRENT_PROJECT_VERSION = 51;
1553+
CURRENT_PROJECT_VERSION = 52;
15541554
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
15551555
DEVELOPMENT_ASSET_PATHS = "\"MarketApp/Preview Content\"";
15561556
DEVELOPMENT_TEAM = N94CS4N6VR;
@@ -1594,7 +1594,7 @@
15941594
CODE_SIGN_ENTITLEMENTS = MarketApp/MarketApp.entitlements;
15951595
CODE_SIGN_IDENTITY = "Apple Development";
15961596
CODE_SIGN_STYLE = Automatic;
1597-
CURRENT_PROJECT_VERSION = 51;
1597+
CURRENT_PROJECT_VERSION = 52;
15981598
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
15991599
DEVELOPMENT_ASSET_PATHS = "\"MarketApp/Preview Content\"";
16001600
DEVELOPMENT_TEAM = N94CS4N6VR;

MarketApp/MarketApp/View/Component/Alert/SignOutPOPUPView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct SignOutPOPUPView: View {
2727
}
2828
.padding(EdgeInsets(top: 40, leading: 30, bottom: 31, trailing: 30))
2929
.frame(width: ContentsWidth, height: 200)
30-
.background(Color.colorAsset.mainColor)
30+
.background(Color.colorAsset.blueGray)
3131
.cornerRadius(30.0)
3232
.shadow(color: Color.fontColor.secondaryTextColor, radius: 6, x: 0, y: .zero)
3333
.animation(.easeOut)
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
//
2+
// InfoView.swift
3+
// MarketApp
4+
//
5+
// Created by 홍태희 on 2022/10/28.
6+
//
7+
8+
import SwiftUI
9+
import Kingfisher
10+
11+
struct DetailImageView: View {
12+
13+
@State private var selectedPicker: DetailTapInfo = .info
14+
@Namespace private var animation
15+
@StateObject var viewModel: MainShoesViewModel = MainShoesViewModel()
16+
let transName: String
17+
18+
19+
var body: some View {
20+
VStack {
21+
selectTapAnimate()
22+
selectDetailTapView()
23+
}
24+
}
25+
26+
@ViewBuilder
27+
private func selectDetailTapView() -> some View {
28+
ScrollView(.vertical, showsIndicators: false) {
29+
if selectedPicker == .info {
30+
productImageInfo(transName: transName)
31+
32+
} else if selectedPicker == .community {
33+
ScrollView(showsIndicators: false) {
34+
ForEach(0..<7) { _ in
35+
CommunityView(nickName: "Zero",
36+
comment: "요즘 매종 키츠네 신발 유행인가요? 알려주세요 :)")
37+
}
38+
}
39+
}
40+
}
41+
.animation(nil)
42+
}
43+
44+
45+
@ViewBuilder
46+
private func selectTapAnimate() -> some View {
47+
HStack {
48+
ForEach(DetailTapInfo.allCases, id: \.self) { item in
49+
VStack {
50+
Text(item.rawValue)
51+
.font(.title3)
52+
.frame(maxWidth: .infinity/4, minHeight: 50)
53+
.foregroundColor(selectedPicker == item ? .black : .gray)
54+
55+
if selectedPicker == item {
56+
Capsule()
57+
.foregroundColor(.black)
58+
.frame(height: 3)
59+
.matchedGeometryEffect(id: "info", in: animation)
60+
}
61+
62+
}
63+
.onTapGesture {
64+
withAnimation(.easeInOut) {
65+
self.selectedPicker = item
66+
}
67+
}
68+
}
69+
}
70+
}
71+
72+
@ViewBuilder
73+
private func productImageInfo(transName: String) -> some View {
74+
if let shoesDetailData = viewModel.shoesDetailData?.filter({ $0.transName == transName }).first {
75+
ForEach(shoesDetailData.productImg, id: \.self) { imageUrl in
76+
KFImage(URL(string: imageUrl))
77+
.loadDiskFileSynchronously()
78+
.resizable()
79+
.frame(width: 340, height: 350)
80+
.onAppear {
81+
viewModel.shoesName = transName
82+
viewModel.mainDetailShoesRequest()
83+
}
84+
}
85+
} else {
86+
ProgressView()
87+
.onAppear {
88+
viewModel.mainDetailShoesRequest()
89+
}
90+
}
91+
}
92+
93+
}
94+
95+
struct DetailImageView_Previews: PreviewProvider {
96+
static var previews: some View {
97+
DetailImageView(transName: "")
98+
}
99+
}

MarketApp/MarketApp/View/ProductDetail/InfoView.swift

Lines changed: 0 additions & 54 deletions
This file was deleted.

MarketApp/MarketApp/View/ProductDetail/ProductInfoImage.swift

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,19 @@
66
//
77

88
import SwiftUI
9+
import Kingfisher
10+
911

1012
struct ProductInfoImage: View {
1113
var selectProductInfoTap : DetailTapInfo
14+
@StateObject var viewModel: MainShoesViewModel = MainShoesViewModel()
15+
let transName: String
1216

1317
var body: some View {
1418
ScrollView(.vertical, showsIndicators: false) {
1519
switch selectProductInfoTap {
1620
case .info:
17-
ForEach(0..<5) { _ in
18-
Text("블랙컬러")
19-
.padding()
20-
Image("shoes")
21-
.resizable()
22-
.frame(maxWidth: 350, minHeight: 500)
23-
}
21+
ProductImageInfo(transName: transName)
2422

2523
case .community:
2624
ScrollView(showsIndicators: false) {
@@ -31,11 +29,34 @@ struct ProductInfoImage: View {
3129
}
3230
}
3331
}
32+
33+
}
34+
35+
36+
37+
@ViewBuilder
38+
private func ProductImageInfo(transName: String) -> some View {
39+
if let shoesDetailData = viewModel.shoesDetailData?.filter({ $0.transName == transName }).first {
40+
ForEach(shoesDetailData.productImg, id: \.self) { item in
41+
KFImage(URL(string: item))
42+
.loadDiskFileSynchronously()
43+
.resizable()
44+
.frame(maxWidth: 350, minHeight: 500)
45+
}.onAppear {
46+
viewModel.shoesName = shoesDetailData.transName
47+
}
48+
49+
} else {
50+
ProgressView()
51+
.onAppear {
52+
viewModel.mainDetailShoesRequest()
53+
}
54+
}
3455
}
3556
}
3657

3758
struct ProductInfoImage_Previews: PreviewProvider {
3859
static var previews: some View {
39-
ProductInfoImage(selectProductInfoTap: .info)
60+
ProductInfoImage(selectProductInfoTap: .info, transName: "(W) 나이키 덩크 로우")
4061
}
4162
}

MarketApp/MarketApp/View/ProductDetail/ProductView.swift

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ struct ProductView: View {
3030
VStack {
3131
ScrollView(.vertical, showsIndicators: true) {
3232

33-
ProductImageView()
33+
productTopImageView()
3434

35-
ProductInfoView(transName: transName)
35+
productInfoView(transName: transName)
3636

37-
InfoView()
37+
DetailImageView(transName: transName)
3838
}
3939
.bounce(false)
4040

@@ -70,7 +70,7 @@ struct ProductView: View {
7070
}
7171

7272
@ViewBuilder
73-
private func ProductImageView() -> some View {
73+
private func productTopImageView() -> some View {
7474
if let shoesDetail = viewModel.shoesDetailData {
7575
let filteredShoesDetail = shoesDetail.filter { $0.transName == self.transName }
7676
if !filteredShoesDetail.isEmpty {
@@ -159,7 +159,7 @@ struct ProductView: View {
159159

160160
//MARK: - 가격및 info 화면
161161
@ViewBuilder
162-
private func ProductInfoView(transName: String) -> some View {
162+
private func productInfoView(transName: String) -> some View {
163163
if let shoesDetailData = viewModel.shoesDetailData?.filter({ $0.transName == transName }).first {
164164
HStack {
165165
VStack {
@@ -206,6 +206,16 @@ struct ProductView: View {
206206
ProgressView()
207207
}
208208
}
209+
210+
@ViewBuilder
211+
private func ProductImageInfo(transName: String) -> some View {
212+
if let shoesDetailData = viewModel.shoesDetailData?.filter({ $0.transName == transName }).first {
213+
ForEach(shoesDetailData.productImg, id: \.self) { item in
214+
KFImage(URL(string: item))
215+
216+
}
217+
}
218+
}
209219
}
210220

211221
struct ProductView_Previews: PreviewProvider {

0 commit comments

Comments
 (0)