TheDocumentation 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.
Level struct is the core data model for every stage in ChefDash. It bundles everything the game engine needs to run a single kitchen round: which ingredients are available, which recipes can appear, how long the player has, and how far they’ve progressed. All 20 levels are represented as Level values stored in GameState.levels, with the first three hand-crafted and levels 4–20 procedurally generated at app launch.
Struct Definition
Fields
Unique level number in the range 1–20. Used as the canonical identifier for sequential unlock logic: when a round is completed,
GameState.finishRound(starsEarned:) searches levels for the entry whose id equals currentLevelId + 1 and sets its isUnlocked to true.Human-readable display name shown on map nodes and in the post-round
VictoryView. The three hand-crafted levels carry descriptive names ("Burger Station", "Green Diner", "Bacon & Grill"), while procedurally generated levels follow the pattern "Kitchen Arcade Expo <N>".The number of orders the player must complete to earn 3 stars and unlock the next level. Difficulty scales with level number: levels 1–3 require 3, 4, and 5 orders respectively; procedurally generated levels use the formula
4 + (id / 2).Array of emoji strings rendered as tappable buttons in
RecipesView. Only ingredients listed here are available to the player during a round — tapping an ingredient calls GameState.addIngredient(_:). The pool grows with difficulty: Level 1 provides ["🍞", "🥩", "🧀"] while higher levels add "🥬", "🍅", "🥓", "🧅", and "🍄".Array of recipe arrays, where each inner array is an ordered sequence of emoji strings representing a complete burger from bottom to top. At the start of every order,
GameState.generateNextOrder() calls .randomElement() on this array to select the target recipe for that round. Each Level always contains exactly two possible recipes.Countdown timer duration in seconds for the round. The three hand-crafted levels use 40 s, 45 s, and 50 s. Procedural levels apply the formula
max(30, 55 - (id * id / 15)), ensuring the timer never drops below 30 seconds even at the highest levels.Controls whether the level node on the map is interactive. Defaults to
false for all levels except Level 1, which initialises with isUnlocked: true. Updated in-place by GameState.finishRound(starsEarned:) using array-index mutation.Highest star rating the player has achieved on this level, in the range 0–3. Persisted for the lifetime of the session (not written to disk).
GameState.finishRound(starsEarned:) updates this value with max(existing, new) so replaying a level never lowers the recorded best.Example: Level 1 Initialisation
The following snippet is taken directly fromGameState.setupLevels() and shows the canonical way a Level value is constructed:
Mutability Note
Level is a Swift value type (struct). Although most fields are declared let and are therefore immutable after initialisation, isUnlocked and starsEarned are declared var. This is intentional: GameState stores levels in a @Published var levels: [Level] array and mutates individual entries directly via their index (e.g. self.levels[index].isUnlocked = true), which triggers SwiftUI’s observation machinery and re-renders the level map.