Skip to content

Commit 0aca744

Browse files
committed
✨[feat]: 상세 디테일 뷰 구현 #22
1 parent 95cf099 commit 0aca744

File tree

8 files changed

+150
-31
lines changed

8 files changed

+150
-31
lines changed

MarketApp/.DS_Store

0 Bytes
Binary file not shown.

MarketApp/Application/MarketAppApp.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ struct MarketAppApp: App {
1414
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
1515
@StateObject var loginViewModel: SignUPViewModel = SignUPViewModel()
1616
@State private var showLanchView: Bool = true
17-
18-
// let providerFactory = AffinityAppCheck()
17+
let providerFactory = AffinityAppCheck()
1918

2019
init() {
21-
// AppCheck.setAppCheckProviderFactory(providerFactory)
20+
AppCheck.setAppCheckProviderFactory(providerFactory)
2221
UINavigationBar.appearance().largeTitleTextAttributes = [.foregroundColor: UIColor(Color.black)]
2322
UINavigationBar.appearance().titleTextAttributes = [.foregroundColor : UIColor(Color.black)]
2423
UINavigationBar.appearance().tintColor = UIColor(Color.black)

MarketApp/MarketApp.xcodeproj/project.pbxproj

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
7F2AD62D29912F0C004DB28B /* ModalShapeCorner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F2AD62C29912F0C004DB28B /* ModalShapeCorner.swift */; };
4545
7F2AD62F299137C5004DB28B /* withDrawPOPUPView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F2AD62E299137C5004DB28B /* withDrawPOPUPView.swift */; };
4646
7F2BCB8C29AD0E4F009DB8B7 /* ShareView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F2BCB8B29AD0E4F009DB8B7 /* ShareView.swift */; };
47+
7F2F571B29BF50FC00E2FFC2 /* MainDetailService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F2F571A29BF50FC00E2FFC2 /* MainDetailService.swift */; };
48+
7F2F571D29BF534B00E2FFC2 /* ShoesDetailModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F2F571C29BF534B00E2FFC2 /* ShoesDetailModel.swift */; };
4749
7F39FA7F29508FAF0041BF8B /* APIError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F39FA7E29508FAF0041BF8B /* APIError.swift */; };
4850
7F39FA85295090F50041BF8B /* CheckRegister.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F39FA84295090F50041BF8B /* CheckRegister.swift */; };
4951
7F39FA882950912F0041BF8B /* ScreenSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F39FA872950912F0041BF8B /* ScreenSize.swift */; };
@@ -171,6 +173,8 @@
171173
7F2AD62C29912F0C004DB28B /* ModalShapeCorner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalShapeCorner.swift; sourceTree = "<group>"; };
172174
7F2AD62E299137C5004DB28B /* withDrawPOPUPView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = withDrawPOPUPView.swift; sourceTree = "<group>"; };
173175
7F2BCB8B29AD0E4F009DB8B7 /* ShareView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareView.swift; sourceTree = "<group>"; };
176+
7F2F571A29BF50FC00E2FFC2 /* MainDetailService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainDetailService.swift; sourceTree = "<group>"; };
177+
7F2F571C29BF534B00E2FFC2 /* ShoesDetailModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoesDetailModel.swift; sourceTree = "<group>"; };
174178
7F39FA7E29508FAF0041BF8B /* APIError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIError.swift; sourceTree = "<group>"; };
175179
7F39FA84295090F50041BF8B /* CheckRegister.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckRegister.swift; sourceTree = "<group>"; };
176180
7F39FA872950912F0041BF8B /* ScreenSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenSize.swift; sourceTree = "<group>"; };
@@ -532,6 +536,7 @@
532536
isa = PBXGroup;
533537
children = (
534538
7F0565D4298686AE0066BE4A /* ShoesModel.swift */,
539+
7F2F571C29BF534B00E2FFC2 /* ShoesDetailModel.swift */,
535540
);
536541
path = Model;
537542
sourceTree = "<group>";
@@ -692,6 +697,7 @@
692697
isa = PBXGroup;
693698
children = (
694699
7FA4BF43299A3EE800D8F2F7 /* MainShoesService.swift */,
700+
7F2F571A29BF50FC00E2FFC2 /* MainDetailService.swift */,
695701
);
696702
path = Main;
697703
sourceTree = "<group>";
@@ -1253,6 +1259,7 @@
12531259
7F0565D5298686AE0066BE4A /* ShoesModel.swift in Sources */,
12541260
EC892AB52908206F00D02F99 /* NaviagationSearchView.swift in Sources */,
12551261
EC892AA12908189600D02F99 /* MainTabView.swift in Sources */,
1262+
7F2F571D29BF534B00E2FFC2 /* ShoesDetailModel.swift in Sources */,
12561263
7F39FA8D2950922D0041BF8B /* ConfirmAlertView.swift in Sources */,
12571264
7F93C34F29856C3A00345AEC /* AffinityAppCheck.swift in Sources */,
12581265
7F204F0029B3974500D3D4FE /* WebViews.swift in Sources */,
@@ -1272,6 +1279,7 @@
12721279
EC892A9F2908189600D02F99 /* MarketAppApp.swift in Sources */,
12731280
7F39FA7F29508FAF0041BF8B /* APIError.swift in Sources */,
12741281
7F2AD62F299137C5004DB28B /* withDrawPOPUPView.swift in Sources */,
1282+
7F2F571B29BF50FC00E2FFC2 /* MainDetailService.swift in Sources */,
12751283
7F4B9625298D171B006AAF48 /* ACarouselViewModel.swift in Sources */,
12761284
7F2AD62D29912F0C004DB28B /* ModalShapeCorner.swift in Sources */,
12771285
7F4189C029B2185D00965AB4 /* BannerImages.swift in Sources */,
@@ -1303,7 +1311,7 @@
13031311
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
13041312
CODE_SIGN_IDENTITY = "Apple Development";
13051313
CODE_SIGN_STYLE = Automatic;
1306-
CURRENT_PROJECT_VERSION = 49;
1314+
CURRENT_PROJECT_VERSION = 50;
13071315
DEBUG_INFORMATION_FORMAT = dwarf;
13081316
DEVELOPMENT_TEAM = N94CS4N6VR;
13091317
GENERATE_INFOPLIST_FILE = YES;
@@ -1330,7 +1338,7 @@
13301338
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
13311339
CODE_SIGN_IDENTITY = "Apple Development";
13321340
CODE_SIGN_STYLE = Automatic;
1333-
CURRENT_PROJECT_VERSION = 49;
1341+
CURRENT_PROJECT_VERSION = 50;
13341342
DEVELOPMENT_TEAM = N94CS4N6VR;
13351343
GENERATE_INFOPLIST_FILE = YES;
13361344
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
@@ -1355,7 +1363,7 @@
13551363
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
13561364
CODE_SIGN_IDENTITY = "Apple Development";
13571365
CODE_SIGN_STYLE = Automatic;
1358-
CURRENT_PROJECT_VERSION = 49;
1366+
CURRENT_PROJECT_VERSION = 50;
13591367
DEBUG_INFORMATION_FORMAT = dwarf;
13601368
DEVELOPMENT_TEAM = N94CS4N6VR;
13611369
GENERATE_INFOPLIST_FILE = YES;
@@ -1381,7 +1389,7 @@
13811389
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
13821390
CODE_SIGN_IDENTITY = "Apple Development";
13831391
CODE_SIGN_STYLE = Automatic;
1384-
CURRENT_PROJECT_VERSION = 49;
1392+
CURRENT_PROJECT_VERSION = 50;
13851393
DEVELOPMENT_TEAM = N94CS4N6VR;
13861394
GENERATE_INFOPLIST_FILE = YES;
13871395
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
@@ -1526,7 +1534,7 @@
15261534
CODE_SIGN_ENTITLEMENTS = MarketApp/MarketApp.entitlements;
15271535
CODE_SIGN_IDENTITY = "Apple Development";
15281536
CODE_SIGN_STYLE = Automatic;
1529-
CURRENT_PROJECT_VERSION = 49;
1537+
CURRENT_PROJECT_VERSION = 50;
15301538
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
15311539
DEVELOPMENT_ASSET_PATHS = "\"MarketApp/Preview Content\"";
15321540
DEVELOPMENT_TEAM = N94CS4N6VR;
@@ -1570,7 +1578,7 @@
15701578
CODE_SIGN_ENTITLEMENTS = MarketApp/MarketApp.entitlements;
15711579
CODE_SIGN_IDENTITY = "Apple Development";
15721580
CODE_SIGN_STYLE = Automatic;
1573-
CURRENT_PROJECT_VERSION = 49;
1581+
CURRENT_PROJECT_VERSION = 50;
15741582
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
15751583
DEVELOPMENT_ASSET_PATHS = "\"MarketApp/Preview Content\"";
15761584
DEVELOPMENT_TEAM = N94CS4N6VR;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// ShoesDetailModel.swift
3+
// MarketApp
4+
//
5+
// Created by 서원지 on 2023/03/13.
6+
//
7+
8+
import Foundation
9+
10+
typealias ShoesDetailModel = [ShoesDetailData]
11+
12+
struct ShoesDetailData: Codable, Identifiable {
13+
let id = UUID()
14+
let shoesId: Int?
15+
let brandName, productName, transName, price: String?
16+
let productImg: String?
17+
18+
enum CodingKeys: String, CodingKey {
19+
case shoesId = "id"
20+
case brandName = "brand_name"
21+
case productName = "product_name"
22+
case transName = "trans_name"
23+
case price
24+
case productImg = "product_img"
25+
}
26+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//
2+
// MainDetailService.swift
3+
// MarketApp
4+
//
5+
// Created by 서원지 on 2023/03/13.
6+
//
7+
8+
import Moya
9+
import Foundation
10+
11+
enum MainDetailService {
12+
case mainShoesDetail(trans_name: String)
13+
}
14+
15+
extension MainDetailService: TargetType {
16+
var baseURL: URL {
17+
return URL(string: "https://640de3d61a18a5db83827295.mockapi.io")!
18+
}
19+
20+
var path: String {
21+
switch self {
22+
case .mainShoesDetail:
23+
return AffinityAPI.MainDetailShoes
24+
}
25+
}
26+
27+
var method: Moya.Method {
28+
switch self {
29+
case .mainShoesDetail(let trans_name):
30+
return .get
31+
}
32+
}
33+
34+
var task: Task {
35+
switch self {
36+
case .mainShoesDetail(let trans_name):
37+
return .requestParameters(parameters: ["trans_name" : trans_name], encoding: URLEncoding.queryString)
38+
}
39+
}
40+
41+
var headers: [String : String]? {
42+
switch self {
43+
case .mainShoesDetail:
44+
return [
45+
"Accept": "application/json",
46+
"Content-Type": "application/json"
47+
]
48+
}
49+
}
50+
}
51+

MarketApp/MarketApp/Network/MarketAPI/AffinityAPI-Main.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Foundation
1010
enum AffinityAPI {
1111

1212
static let MainShoes = String("/v3/a238cfb6-d2fa-4884-b42c-a796abe580a1")
13+
static let MainDetailShoes = String("/shoes/")
1314

1415

1516
}

MarketApp/MarketApp/ViewModel/MainShoesViewModel/MainShoesViewModel.swift

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ import Moya
1212
class MainShoesViewModel: ObservableObject {
1313

1414
@Published var shoesData: ShoesModel?
15+
@Published var shoesDetailData: ShoesDetailModel?
16+
1517
var shoesCancellable: AnyCancellable?
18+
var shoesDetailCancellable: AnyCancellable?
19+
1620

1721
init() {
1822
// mainShoesRequest()
@@ -22,6 +26,10 @@ class MainShoesViewModel: ObservableObject {
2226
self.shoesData = list
2327
}
2428

29+
func toDetailViewModel(_ list: ShoesDetailModel) {
30+
self.shoesDetailData = list
31+
}
32+
2533

2634
//MARK: - 신발 전체 데이터
2735
func mainShoesRequest() {
@@ -45,4 +53,30 @@ class MainShoesViewModel: ObservableObject {
4553
self.toViewModel(shoesData)
4654
})
4755
}
56+
57+
58+
//MARK: - 신발 상세 데이터
59+
func mainDetailShoesRequest(transName: String) {
60+
if let cancellable = shoesDetailCancellable {
61+
cancellable.cancel()
62+
}
63+
64+
let provider = MoyaProvider<MainDetailService>()
65+
shoesDetailCancellable = provider.requestPublisher(.mainShoesDetail(trans_name: transName))
66+
.compactMap { $0 }
67+
.sink(receiveCompletion: { result in
68+
switch result {
69+
case .failure(let error):
70+
print(error.localizedDescription)
71+
case .finished:
72+
print("신발 데이터")
73+
}
74+
}, receiveValue: { [weak self] model in
75+
let data = try? model.map(ShoesDetailModel.self)
76+
guard let shoesDetailData = data else { return }
77+
print("신발 상세 데이터 \(shoesDetailData)")
78+
self?.toDetailViewModel(shoesDetailData)
79+
})
80+
81+
}
4882
}

MarketApp/fastlane/report.xml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,112 +5,112 @@
55

66

77

8-
<testcase classname="fastlane.lanes" name="00: update_fastlane" time="3.709559">
8+
<testcase classname="fastlane.lanes" name="00: update_fastlane" time="3.091349">
99

1010
</testcase>
1111

1212

13-
<testcase classname="fastlane.lanes" name="01: default_platform" time="0.000286">
13+
<testcase classname="fastlane.lanes" name="01: default_platform" time="0.000292">
1414

1515
</testcase>
1616

1717

18-
<testcase classname="fastlane.lanes" name="02: get_version_number" time="0.089047">
18+
<testcase classname="fastlane.lanes" name="02: get_version_number" time="0.077911">
1919

2020
</testcase>
2121

2222

23-
<testcase classname="fastlane.lanes" name="03: get_build_number" time="4.461042">
23+
<testcase classname="fastlane.lanes" name="03: get_build_number" time="4.179364">
2424

2525
</testcase>
2626

2727

28-
<testcase classname="fastlane.lanes" name="04: get_certificates" time="6.00469">
28+
<testcase classname="fastlane.lanes" name="04: get_certificates" time="6.218156">
2929

3030
</testcase>
3131

3232

33-
<testcase classname="fastlane.lanes" name="05: get_provisioning_profile" time="5.19806">
33+
<testcase classname="fastlane.lanes" name="05: get_provisioning_profile" time="5.225867">
3434

3535
</testcase>
3636

3737

38-
<testcase classname="fastlane.lanes" name="06: latest_testflight_build_number" time="5.394895">
38+
<testcase classname="fastlane.lanes" name="06: latest_testflight_build_number" time="5.397125">
3939

4040
</testcase>
4141

4242

43-
<testcase classname="fastlane.lanes" name="07: increment_build_number" time="7.396647">
43+
<testcase classname="fastlane.lanes" name="07: increment_build_number" time="8.373189">
4444

4545
</testcase>
4646

4747

48-
<testcase classname="fastlane.lanes" name="08: Switch to ios lint lane" time="0.000351">
48+
<testcase classname="fastlane.lanes" name="08: Switch to ios lint lane" time="0.00071">
4949

5050
</testcase>
5151

5252

53-
<testcase classname="fastlane.lanes" name="09: swiftlint" time="1.214122">
53+
<testcase classname="fastlane.lanes" name="09: swiftlint" time="3.96327">
5454

5555
</testcase>
5656

5757

58-
<testcase classname="fastlane.lanes" name="10: Switch to ios build_ipa lane" time="0.000301">
58+
<testcase classname="fastlane.lanes" name="10: Switch to ios build_ipa lane" time="0.000387">
5959

6060
</testcase>
6161

6262

63-
<testcase classname="fastlane.lanes" name="11: clear_derived_data" time="50.016063">
63+
<testcase classname="fastlane.lanes" name="11: clear_derived_data" time="19.584324">
6464

6565
</testcase>
6666

6767

68-
<testcase classname="fastlane.lanes" name="12: slack" time="0.522775">
68+
<testcase classname="fastlane.lanes" name="12: slack" time="0.556588">
6969

7070
</testcase>
7171

7272

73-
<testcase classname="fastlane.lanes" name="13: gym" time="365.469572">
73+
<testcase classname="fastlane.lanes" name="13: gym" time="397.156109">
7474

7575
</testcase>
7676

7777

78-
<testcase classname="fastlane.lanes" name="14: slack" time="0.485733">
78+
<testcase classname="fastlane.lanes" name="14: slack" time="0.595177">
7979

8080
</testcase>
8181

8282

83-
<testcase classname="fastlane.lanes" name="15: upload_to_testflight" time="318.536478">
83+
<testcase classname="fastlane.lanes" name="15: upload_to_testflight" time="328.592728">
8484

8585
</testcase>
8686

8787

88-
<testcase classname="fastlane.lanes" name="16: slack" time="0.568718">
88+
<testcase classname="fastlane.lanes" name="16: slack" time="0.480993">
8989

9090
</testcase>
9191

9292

93-
<testcase classname="fastlane.lanes" name="17: Switch to ios upload_firebase lane" time="0.000273">
93+
<testcase classname="fastlane.lanes" name="17: Switch to ios upload_firebase lane" time="0.000322">
9494

9595
</testcase>
9696

9797

98-
<testcase classname="fastlane.lanes" name="18: get_version_number" time="0.078489">
98+
<testcase classname="fastlane.lanes" name="18: get_version_number" time="0.044372">
9999

100100
</testcase>
101101

102102

103-
<testcase classname="fastlane.lanes" name="19: get_build_number" time="3.860618">
103+
<testcase classname="fastlane.lanes" name="19: get_build_number" time="4.533198">
104104

105105
</testcase>
106106

107107

108-
<testcase classname="fastlane.lanes" name="20: firebase_app_distribution" time="19.327357">
108+
<testcase classname="fastlane.lanes" name="20: firebase_app_distribution" time="12.949089">
109109

110110
</testcase>
111111

112112

113-
<testcase classname="fastlane.lanes" name="21: slack" time="0.468214">
113+
<testcase classname="fastlane.lanes" name="21: slack" time="0.47004">
114114

115115
</testcase>
116116

0 commit comments

Comments
 (0)