Skip to content

Commit

Permalink
feat: ingredient 타입 생성, Recipe 관련 상수 추가 #1
Browse files Browse the repository at this point in the history
  • Loading branch information
just1103 committed Oct 19, 2021
1 parent a5ebe9d commit a1f49d1
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion JuiceMaker/JuiceMaker/Model/JuiceMaker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation
struct Juice {
var name: JuiceName
var count: Int = 0

enum JuiceName {
case strawberryJuice
case bananaJuice
Expand All @@ -23,5 +23,25 @@ struct Juice {

// 쥬스 메이커 타입
struct JuiceMaker {
var store = FruitStore()

typealias ingredient = (fruit: Fruit.FruitName, count: Int)

let strawberryJuiceRecipe: [ingredient] = [(.strawberry, 16)]
let bananaJuiceRecipe: [ingredient] = [(.banana, 2)]
let kiwiJuiceRecipe: [ingredient] = [(.kiwi, 3)]
let pineappleJuiceRecipe: [ingredient] = [(.pineapple, 2)]
let strawberryBananaJuiceRecipe: [ingredient] = [(.strawberry, 10), (.banana, 1)]
let mangoJuiceRecipe: [ingredient] = [(.mango, 3)]
let mangoKiwiJuiceRecipe: [ingredient] = [(.mango, 2), (.kiwi, 1)]

lazy var recipe: [Juice.JuiceName: [ingredient]] = [
.strawberryJuice: strawberryJuiceRecipe,
.bananaJuice: bananaJuiceRecipe,
.kiwiJuice: kiwiJuiceRecipe,
.pineappleJuice: pineappleJuiceRecipe,
.strawberryBananaJuice: strawberryBananaJuiceRecipe,
.mangoJuice: mangoJuiceRecipe,
.mangoKiwiJuice: mangoKiwiJuiceRecipe
]
}

0 comments on commit a1f49d1

Please sign in to comment.