Repository navigation
feat(2048): gameplay ui — board, gestures, viewmodel — SDD-004 m3 (#479) - #497
Merged
Merged
Conversation
…elines (SDD-004 M3) - Game2048GameViewModel: @mainactor @observable bridge over Game2048Session; slide/pause/resume/refresh; seeded preview seam; persistCurrentState() stub documented for M4 (no PersistenceKit dep yet) - Game2048TileView: 4×4 cell renderer with value→colour palette (2…2048+) - Game2048BoardView: 4×4 grid, DragGesture swipe in 4 directions, compact/ mac layout split, gameChrome elapsed push (mm:ss), PauseOverlayView cover, inline "Game Over" stuck overlay (M4 → shared CompletionScreen) - GameMode: leaf enum mirroring MinesweeperUI (daily/practice) - AppRoute: expanded board(seed:mode:) parameters; settings stub - Game2048Root: NavigationStack wired with daily/practice seed derivation - Game2048UITests: 9 ViewModel unit tests (all pass) + 6 snapshot baselines (initial/midGame/stuck ×light/dark) - Localizable.xcstrings: 10 strings ×7 locales; scan:l10n green - Package.swift: M3 deps (Game2048CoreKit, GameAppKit, swift-snapshot-testing) Co-Authored-By: Claude Fable 5 <[email protected]>
- TileView: split 12-arm switch into two ≤10-complexity helpers; remove superfluous identifier_name disable (not triggered) - BoardView: remove superfluous file_length disable (file is under 400 lines) - Snapshot fixture: collapse extra comma spacing in tile literal arrays Co-Authored-By: Claude Fable 5 <[email protected]>
…lexity gate) Cyclomatic complexity rule ≤ 10: an 11-arm switch exceeds it; a dictionary lookup has complexity 1 regardless of entry count. Co-Authored-By: Claude Fable 5 <[email protected]>
blocking-1: add `stuckOverlayForSnapshot: Bool` init param to Game2048BoardView; overlay condition is now `viewModel.isTerminal && (!suppressTickerForSnapshot || stuckOverlayForSnapshot)`. Stuck snapshot tests pass the new flag; two baselines re-recorded with the "Game Over" card visible. Mirrors MinesweeperBoardView's `completionViewModelForSnapshot` seam (#388 / #315). blocking-2: replace @State tickerTask + .onAppear/.onDisappear with a single `.task(id: ObjectIdentifier(viewModel))` loop (structured cancellation on disappear; VM-swap restarts it). Matches MinesweeperBoardView line ~229 and Sudoku BoardView line ~63 exactly. Also removed the incoherent comment block that claimed a "nonisolated(unsafe) stored property" when it was @State. nit (folded): update header comment to note .task(id:) is correct here (#361 arm64 bug is Root-only bootstrap, not long-lived ticker loops); add M4 L10n comment per review instruction. Co-Authored-By: Claude Fable 5 <[email protected]>
…statement Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Milestone 3 of SDD-004: the 2048 board is playable.
Game2048GameViewModel(@mainactor @observable over the actor session) +Game2048BoardView(4×4 grid, swipe gestures → slide, spring tile animation,\.gameChromemm:ss push, scenePhase save trigger, pause overlay, inline stuck card) +Game2048TileView+ GameMode + expanded AppRoute + Game2048Root nav. Mirrors the Minesweeper gameplay twins file-for-file.9/9 ViewModel tests, 6 board snapshots (initial/midGame/stuck × light/dark), scan:l10n green (3 catalogs). 1258 LOC running total (#479 budget ≤2.5k; ~1.2k headroom for M4). M3→M4 seams documented (persistence, GC submit, banner, completion screen, modal GameRoot flow, theme).
🤖 Generated with Claude Code