diff --git a/JuiceMaker/JuiceMaker.xcodeproj/project.pbxproj b/JuiceMaker/JuiceMaker.xcodeproj/project.pbxproj index bfb89efbe..33485f120 100644 --- a/JuiceMaker/JuiceMaker.xcodeproj/project.pbxproj +++ b/JuiceMaker/JuiceMaker.xcodeproj/project.pbxproj @@ -11,7 +11,6 @@ 73B6685227BBE7CE005CF6E3 /* FruitType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73B6685127BBE7CE005CF6E3 /* FruitType.swift */; }; 73B6686127BC026A005CF6E3 /* FruitStoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73B6685927BBFEE3005CF6E3 /* FruitStoreTests.swift */; }; 73B6686327BD18D3005CF6E3 /* JuiceRecipes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73B6686227BD18D3005CF6E3 /* JuiceRecipes.swift */; }; - 73B6686727BD37CE005CF6E3 /* FruitsInventory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73B6686627BD37CE005CF6E3 /* FruitsInventory.swift */; }; C71CD66B266C7ACB0038B9CB /* FruitStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = C71CD66A266C7ACB0038B9CB /* FruitStore.swift */; }; C73DAF37255D0CDD00020D38 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C73DAF36255D0CDD00020D38 /* AppDelegate.swift */; }; C73DAF39255D0CDD00020D38 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C73DAF38255D0CDD00020D38 /* SceneDelegate.swift */; }; @@ -38,7 +37,6 @@ 73B6685727BBFEE3005CF6E3 /* JuiceMakerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JuiceMakerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 73B6685927BBFEE3005CF6E3 /* FruitStoreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FruitStoreTests.swift; sourceTree = ""; }; 73B6686227BD18D3005CF6E3 /* JuiceRecipes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JuiceRecipes.swift; sourceTree = ""; }; - 73B6686627BD37CE005CF6E3 /* FruitsInventory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FruitsInventory.swift; sourceTree = ""; }; C71CD66A266C7ACB0038B9CB /* FruitStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FruitStore.swift; sourceTree = ""; }; C73DAF33255D0CDD00020D38 /* JuiceMaker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JuiceMaker.app; sourceTree = BUILT_PRODUCTS_DIR; }; C73DAF36255D0CDD00020D38 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -91,7 +89,6 @@ C71CD66F266C7B500038B9CB /* Model */ = { isa = PBXGroup; children = ( - 73B6686627BD37CE005CF6E3 /* FruitsInventory.swift */, C71CD66A266C7ACB0038B9CB /* FruitStore.swift */, 73B6685127BBE7CE005CF6E3 /* FruitType.swift */, C73DAF4B255D0D0400020D38 /* JuiceMaker.swift */, @@ -251,7 +248,6 @@ C71CD66B266C7ACB0038B9CB /* FruitStore.swift in Sources */, 73B6686327BD18D3005CF6E3 /* JuiceRecipes.swift in Sources */, C73DAF3B255D0CDD00020D38 /* ViewController.swift in Sources */, - 73B6686727BD37CE005CF6E3 /* FruitsInventory.swift in Sources */, C73DAF37255D0CDD00020D38 /* AppDelegate.swift in Sources */, C73DAF39255D0CDD00020D38 /* SceneDelegate.swift in Sources */, 73B6685227BBE7CE005CF6E3 /* FruitType.swift in Sources */, diff --git a/JuiceMaker/JuiceMaker/Model/FruitStore.swift b/JuiceMaker/JuiceMaker/Model/FruitStore.swift index 771ee0884..c9666728f 100644 --- a/JuiceMaker/JuiceMaker/Model/FruitStore.swift +++ b/JuiceMaker/JuiceMaker/Model/FruitStore.swift @@ -21,6 +21,9 @@ extension FruitStoreError: LocalizedError { /// 과일 저장소 타입 final class FruitStore { + + typealias FruitsInventory = [FruitType: Int] + private(set) var inventory = FruitsInventory() init(initialFruitCount: Int = 10) { diff --git a/JuiceMaker/JuiceMaker/Model/FruitsInventory.swift b/JuiceMaker/JuiceMaker/Model/FruitsInventory.swift deleted file mode 100644 index c41c83423..000000000 --- a/JuiceMaker/JuiceMaker/Model/FruitsInventory.swift +++ /dev/null @@ -1,10 +0,0 @@ -// -// FruitsInventory.swift -// JuiceMaker -// -// Created by 김정상 on 2022/02/16. -// - -import Foundation - -typealias FruitsInventory = [FruitType: Int] diff --git a/JuiceMaker/JuiceMaker/Model/JuiceRecipes.swift b/JuiceMaker/JuiceMaker/Model/JuiceRecipes.swift index 3c2231e7d..a85086f66 100644 --- a/JuiceMaker/JuiceMaker/Model/JuiceRecipes.swift +++ b/JuiceMaker/JuiceMaker/Model/JuiceRecipes.swift @@ -7,49 +7,51 @@ import Foundation +typealias FruitItems = [FruitType: Int] + protocol RecipeProtocol { - var items: FruitsInventory { get } + var items: FruitItems { get } } struct StrawberryJuice: RecipeProtocol { - var items: FruitsInventory = [ + var items: FruitItems = [ .strawberry: 16 ] } struct BananaJuice: RecipeProtocol { - var items: FruitsInventory = [ + var items: FruitItems = [ .banana: 2 ] } struct PineappleJuice: RecipeProtocol { - var items: FruitsInventory = [ + var items: FruitItems = [ .pineapple: 2 ] } struct KiwiJuice: RecipeProtocol { - var items: FruitsInventory = [ + var items: FruitItems = [ .kiwi: 3 ] } struct MangoJuice: RecipeProtocol { - var items: FruitsInventory = [ + var items: FruitItems = [ .mango: 3 ] } struct StrawberryBananaJuice: RecipeProtocol { - var items: FruitsInventory = [ + var items: FruitItems = [ .strawberry: 10, .banana: 1 ] } struct MangoKiwiJuice: RecipeProtocol { - var items: FruitsInventory = [ + var items: FruitItems = [ .mango: 2, .kiwi: 1 ]