Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ImLukzy/ChefDash/llms.txt

Use this file to discover all available pages before exploring further.

GameState is a class conforming to ObservableObject that serves as the single source of truth for all mutable application state in ChefDash. Every screen in the game — from the home HUD to the in-round cooking view — reads from and reacts to its @Published properties via SwiftUI’s reactive binding system. The object is created once at app launch and injected throughout the view hierarchy using @EnvironmentObject, so any property change is automatically reflected across all subscribing views without manual notification wiring.
activeTab
String
default:"\"house.fill\""
The identifier of the currently visible screen. ContentView uses a switch on this value to decide which top-level view to render. The CustomTabBar writes to this property when the player taps a tab icon.
ValueScreen
"house.fill"HomeView (default)
"map.fill"MainMapView
"cart.fill"ShopView
"profile"ProfileView
"settings"SettingsView
"kitchen_round"RecipesView (active round)
"level_complete"VictoryView
The CustomTabBar is hidden whenever activeTab is "kitchen_round" or "level_complete", so the player cannot navigate away mid-round.

Player Data

coins
Int
default:"150"
The player’s current coin balance. Coins are awarded after each successful order via triggerSuccess() and are spent when the player purchases items from the shop. The formula for a successful order is (25 + sauceBonus) × comboMultiplier.
isHapticsEnabled
Bool
default:"true"
Master toggle for haptic feedback. When true, UIImpactFeedbackGenerator calls elsewhere in the app are allowed to fire. When false, those calls are suppressed. The player controls this via the Settings screen.
playerName
String
default:"\"Chef Novato\""
The display name shown in the HomeView HUD. The player can edit this in SettingsView or ProfileView.
playerAvatar
String
default:"\"👨‍🍳\""
The emoji avatar shown alongside playerName in the HomeView HUD. Stored as a plain String so any emoji character can be assigned.

Level Management

levels
[Level]
default:"populated by setupLevels()"
The complete ordered array of all 20 Level objects, built during init() by setupLevels(). The first three levels — Burger Station (id 1), Green Diner (id 2), and Bacon & Grill (id 3) — are hand-crafted with curated ingredients and recipes. Levels 4–20 are generated procedurally with scaled difficulty. Level 1 is the only entry with isUnlocked: true on a fresh install; all others start locked.
Because finishRound(starsEarned:) looks up the next level by id rather than by array index, the order of entries in this array can be changed freely without breaking unlock logic.
selectedLevelIndex
Int
default:"0"
The zero-based index into the levels array pointing to the level the player has tapped on MainMapView. The computed property currentLevel reads from this index, and finishRound(starsEarned:) writes to levels[selectedLevelIndex] to record stars. Default 0 means Level 1 is pre-selected.

Active Gameplay

currentBurgerStack
[String]
A live array of ingredient emojis the player has tapped so far during the current order. Each call to addIngredient(_:) appends to this array. It is cleared at the start of every new order (via generateNextOrder()) and also reset after a failed ingredient tap (via triggerError()).
targetRecipeEmojis
[String]
The ordered list of ingredient emojis that define the current target recipe, set by generateNextOrder(). addIngredient(_:) compares currentBurgerStack against this array element-by-element to detect errors and, when lengths match exactly and all ingredients are correct, to trigger a success.
currentRecipeName
String
The human-readable name of the active recipe, derived from targetRecipeEmojis by generateNextOrder(). The three possible values are:
Recipe nameTrigger condition
"Mega Bacon Burger"Recipe contains 🥓
"Fresh Veggie Burger"Recipe contains 🥬 (and no bacon)
"Classic Cheeseburger"All other recipes
ordersCompletedInSession
Int
default:"0"
A running count of orders successfully completed since the current round started. triggerSuccess() increments this value, and startNewRound() resets it to 0. RecipesView uses this count alongside currentLevel.targetOrders to know when to call finishRound(starsEarned:).
comboMultiplier
Int
default:"1"
The current coins multiplier applied to each successful order. The property always initialises to 1; startNewRound() then raises it to 2 immediately if the Cuchillo Afilado upgrade is equipped. During a round it increments by 1 on every triggerSuccess() call, capped at a maximum of 5. A single wrong ingredient resets it to 1 via triggerError().

Visual Feedback

showPerfectMessage
Bool
default:"false"
Set to true for exactly 0.8 seconds after triggerSuccess() fires. RecipesView observes this flag to display a success overlay animation. After the delay, it is reset to false and the next order is generated.
showErrorMessage
Bool
default:"false"
Set to true for exactly 0.8 seconds after triggerError() fires. RecipesView observes this flag to display an error overlay animation. After the delay, it is reset to false and currentBurgerStack is cleared so the player can retry the same order.

Shop

shopInventory
[ShopItem]
The three purchasable consumable items available in ShopView. Each ShopItem is initialized with quantityOwned: 0. Purchasing an item increments quantityOwned; equipping it for a round and then calling startNewRound() decrements it.
idTitleEmojiPriceEffect
"oven"Horno Industrial🌋50+15s bonus time via onRecipeSuccessBonusTime
"knife"Cuchillo Afilado🔪30Starts round at comboMultiplier = 2
"sauce"Salsa Secreta🥫40+10 bonus coins per perfect order
selectedUpgradesForRound
Set<String>
A Set of item id strings the player has selected in the pre-game upgrade modal to be active for the next round. startNewRound() reads this set, applies each upgrade’s effect, decrements the corresponding quantityOwned values, then clears the set so upgrades are single-use.

Callbacks

onRecipeSuccessBonusTime
(() -> Void)?
An optional closure that RecipesView assigns during its setup to receive bonus time notifications. triggerSuccess() calls this closure unconditionally after every successful order — when the Horno Industrial ("oven") upgrade is active, RecipesView assigns a closure that adds bonus time; otherwise the property is nil and the call is a no-op. This keeps GameState fully decoupled from any specific view type.

Build docs developers (and LLMs) love