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.
Navigation
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.| Value | Screen |
|---|---|
"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
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.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.The display name shown in the
HomeView HUD. The player can edit this in SettingsView or ProfileView.The emoji avatar shown alongside
playerName in the HomeView HUD. Stored as a plain String so any emoji character can be assigned.Level Management
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.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
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()).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.The human-readable name of the active recipe, derived from
targetRecipeEmojis by generateNextOrder(). The three possible values are:| Recipe name | Trigger condition |
|---|---|
"Mega Bacon Burger" | Recipe contains 🥓 |
"Fresh Veggie Burger" | Recipe contains 🥬 (and no bacon) |
"Classic Cheeseburger" | All other recipes |
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:).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
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.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
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.id | Title | Emoji | Price | Effect |
|---|---|---|---|---|
"oven" | Horno Industrial | 🌋 | 50 | +15s bonus time via onRecipeSuccessBonusTime |
"knife" | Cuchillo Afilado | 🔪 | 30 | Starts round at comboMultiplier = 2 |
"sauce" | Salsa Secreta | 🥫 | 40 | +10 bonus coins per perfect order |
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
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.