Skip to content

Commit 975ee30

Browse files
author
Lina.L
authored
Revert "쥬스 메이커 [STEP 1] Ohtt, JAEYOUNGYUN"
1 parent ee1cb90 commit 975ee30

File tree

8 files changed

+3
-192
lines changed

8 files changed

+3
-192
lines changed

JuiceMaker/JuiceMaker.xcodeproj/project.pbxproj

+1-48
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 52;
6+
objectVersion = 50;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -15,10 +15,6 @@
1515
C73DAF40255D0CDE00020D38 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C73DAF3F255D0CDE00020D38 /* Assets.xcassets */; };
1616
C73DAF43255D0CDF00020D38 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C73DAF41255D0CDF00020D38 /* LaunchScreen.storyboard */; };
1717
C73DAF4C255D0D0400020D38 /* JuiceMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = C73DAF4B255D0D0400020D38 /* JuiceMaker.swift */; };
18-
D11B964F27BBEC17002A7652 /* RxCocoa in Frameworks */ = {isa = PBXBuildFile; productRef = D11B964E27BBEC17002A7652 /* RxCocoa */; };
19-
D11B965527BBF09E002A7652 /* Fruit.swift in Sources */ = {isa = PBXBuildFile; fileRef = D11B965427BBF09E002A7652 /* Fruit.swift */; };
20-
D11B965727BBF8E9002A7652 /* Juice.swift in Sources */ = {isa = PBXBuildFile; fileRef = D11B965627BBF8E9002A7652 /* Juice.swift */; };
21-
D11B967B27BE8C93002A7652 /* JuiceMakerError.swift in Sources */ = {isa = PBXBuildFile; fileRef = D11B967A27BE8C93002A7652 /* JuiceMakerError.swift */; };
2218
/* End PBXBuildFile section */
2319

2420
/* Begin PBXFileReference section */
@@ -32,17 +28,13 @@
3228
C73DAF42255D0CDF00020D38 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
3329
C73DAF44255D0CDF00020D38 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3430
C73DAF4B255D0D0400020D38 /* JuiceMaker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JuiceMaker.swift; sourceTree = "<group>"; };
35-
D11B965427BBF09E002A7652 /* Fruit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Fruit.swift; sourceTree = "<group>"; };
36-
D11B965627BBF8E9002A7652 /* Juice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Juice.swift; sourceTree = "<group>"; };
37-
D11B967A27BE8C93002A7652 /* JuiceMakerError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JuiceMakerError.swift; sourceTree = "<group>"; };
3831
/* End PBXFileReference section */
3932

4033
/* Begin PBXFrameworksBuildPhase section */
4134
C73DAF30255D0CDC00020D38 /* Frameworks */ = {
4235
isa = PBXFrameworksBuildPhase;
4336
buildActionMask = 2147483647;
4437
files = (
45-
D11B964F27BBEC17002A7652 /* RxCocoa in Frameworks */,
4638
);
4739
runOnlyForDeploymentPostprocessing = 0;
4840
};
@@ -64,9 +56,6 @@
6456
children = (
6557
C73DAF4B255D0D0400020D38 /* JuiceMaker.swift */,
6658
C71CD66A266C7ACB0038B9CB /* FruitStore.swift */,
67-
D11B965427BBF09E002A7652 /* Fruit.swift */,
68-
D11B965627BBF8E9002A7652 /* Juice.swift */,
69-
D11B967A27BE8C93002A7652 /* JuiceMakerError.swift */,
7059
);
7160
path = Model;
7261
sourceTree = "<group>";
@@ -103,19 +92,11 @@
10392
C71CD66D266C7B470038B9CB /* Controller */,
10493
C71CD66F266C7B500038B9CB /* Model */,
10594
C71CD671266C7B570038B9CB /* View */,
106-
D11B965027BBECB1002A7652 /* ViewModel */,
10795
C73DAF44255D0CDF00020D38 /* Info.plist */,
10896
);
10997
path = JuiceMaker;
11098
sourceTree = "<group>";
11199
};
112-
D11B965027BBECB1002A7652 /* ViewModel */ = {
113-
isa = PBXGroup;
114-
children = (
115-
);
116-
path = ViewModel;
117-
sourceTree = "<group>";
118-
};
119100
/* End PBXGroup section */
120101

121102
/* Begin PBXNativeTarget section */
@@ -132,9 +113,6 @@
132113
dependencies = (
133114
);
134115
name = JuiceMaker;
135-
packageProductDependencies = (
136-
D11B964E27BBEC17002A7652 /* RxCocoa */,
137-
);
138116
productName = JuiceMaker;
139117
productReference = C73DAF33255D0CDD00020D38 /* JuiceMaker.app */;
140118
productType = "com.apple.product-type.application";
@@ -162,9 +140,6 @@
162140
Base,
163141
);
164142
mainGroup = C73DAF2A255D0CDC00020D38;
165-
packageReferences = (
166-
D11B964D27BBEC17002A7652 /* XCRemoteSwiftPackageReference "RxSwift" */,
167-
);
168143
productRefGroup = C73DAF34255D0CDD00020D38 /* Products */;
169144
projectDirPath = "";
170145
projectRoot = "";
@@ -194,11 +169,8 @@
194169
files = (
195170
C71CD66B266C7ACB0038B9CB /* FruitStore.swift in Sources */,
196171
C73DAF3B255D0CDD00020D38 /* ViewController.swift in Sources */,
197-
D11B967B27BE8C93002A7652 /* JuiceMakerError.swift in Sources */,
198172
C73DAF37255D0CDD00020D38 /* AppDelegate.swift in Sources */,
199-
D11B965527BBF09E002A7652 /* Fruit.swift in Sources */,
200173
C73DAF39255D0CDD00020D38 /* SceneDelegate.swift in Sources */,
201-
D11B965727BBF8E9002A7652 /* Juice.swift in Sources */,
202174
C73DAF4C255D0D0400020D38 /* JuiceMaker.swift in Sources */,
203175
);
204176
runOnlyForDeploymentPostprocessing = 0;
@@ -399,25 +371,6 @@
399371
defaultConfigurationName = Release;
400372
};
401373
/* End XCConfigurationList section */
402-
403-
/* Begin XCRemoteSwiftPackageReference section */
404-
D11B964D27BBEC17002A7652 /* XCRemoteSwiftPackageReference "RxSwift" */ = {
405-
isa = XCRemoteSwiftPackageReference;
406-
repositoryURL = "https://github.com/ReactiveX/RxSwift";
407-
requirement = {
408-
kind = upToNextMajorVersion;
409-
minimumVersion = 6.0.0;
410-
};
411-
};
412-
/* End XCRemoteSwiftPackageReference section */
413-
414-
/* Begin XCSwiftPackageProductDependency section */
415-
D11B964E27BBEC17002A7652 /* RxCocoa */ = {
416-
isa = XCSwiftPackageProductDependency;
417-
package = D11B964D27BBEC17002A7652 /* XCRemoteSwiftPackageReference "RxSwift" */;
418-
productName = RxCocoa;
419-
};
420-
/* End XCSwiftPackageProductDependency section */
421374
};
422375
rootObject = C73DAF2B255D0CDC00020D38 /* Project object */;
423376
}

JuiceMaker/JuiceMaker.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

-16
This file was deleted.

JuiceMaker/JuiceMaker/Model/Fruit.swift

-16
This file was deleted.

JuiceMaker/JuiceMaker/Model/FruitStore.swift

+1-27
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,7 @@
66

77
import Foundation
88

9-
protocol FruitStorable {
10-
func updateStock(of fruit: Fruit, quantity: Int)
11-
func stock(of fruit: Fruit) -> Int?
12-
}
13-
149
// 과일 저장소 타입
15-
class FruitStore: FruitStorable {
16-
private var store: [Fruit: Int] = [.strawberry: 10 ,
17-
.banana: 10,
18-
.pineapple: 10,
19-
.mango: 10,
20-
.kiwi: 10]
21-
22-
init(qauntity: Int) {
23-
Fruit.allCases.forEach {
24-
store[$0] = qauntity
25-
}
26-
}
27-
28-
func updateStock(of fruit: Fruit, quantity: Int) {
29-
guard store[fruit] != nil,
30-
quantity >= 0 else { return }
10+
class FruitStore {
3111

32-
store[fruit] = quantity
33-
}
34-
35-
func stock(of fruit: Fruit) -> Int? {
36-
return store[fruit]
37-
}
3812
}

JuiceMaker/JuiceMaker/Model/Juice.swift

-40
This file was deleted.

JuiceMaker/JuiceMaker/Model/JuiceMaker.swift

+1-28
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,7 @@
66

77
import Foundation
88

9-
protocol JuiceMakable {
10-
func make(juice: Juice) throws
11-
}
12-
139
// 쥬스 메이커 타입
14-
struct JuiceMaker: JuiceMakable {
15-
private var fruitStore: FruitStorable
16-
17-
init(fruitStore: FruitStorable) {
18-
self.fruitStore = fruitStore
19-
}
20-
21-
func make(juice: Juice) throws {
22-
let ingredients = juice.ingredients
23-
var updatedStocks: [Int] = []
24-
try ingredients.forEach { (fruit, quantity) in
25-
let originQuantity = fruitStore.stock(of: fruit) ?? 0
26-
let updatedStock = originQuantity - quantity
27-
28-
guard updatedStock >= 0 else {
29-
throw JuiceMakerError.notEnoughStock
30-
}
31-
32-
updatedStocks.append(updatedStock)
33-
}
10+
struct JuiceMaker {
3411

35-
for (index, (fruit, _)) in ingredients.enumerated() {
36-
fruitStore.updateStock(of: fruit, quantity: updatedStocks[index])
37-
}
38-
}
3912
}

JuiceMaker/JuiceMaker/Model/JuiceMakerError.swift

-12
This file was deleted.

README.md

-5
This file was deleted.

0 commit comments

Comments
 (0)