XCode-Claude-Workflow/CLAUDE.md
idev2025 0f989f5c86 feat: SoliCards v1.2.0 — native SwiftUI solitaire for iOS, iPadOS, macOS
Complete native rewrite of the web-based SoliCards game as a SwiftUI
multiplatform app targeting iOS 17+, iPadOS 17+, and macOS 14+.

Three solitaire variants (Klondike, Spider, FreeCell) with full game
rules, drag & drop, smart zoom layout, 6 themes, 4 difficulty levels,
SwiftData persistence, VoiceOver accessibility, and 57 unit tests.

Key features:
- MVVM + Protocol-Oriented Strategy architecture
- DragGesture with coordinate-space hit-testing (long press + drag)
- Smart zoom: cards auto-size to fit screen based on deepest column
- Landscape: 30% bigger cards with scrollable overflow (iOS)
- macOS: 120pt card cap, 92% height buffer for window resizing
- Auto-save, game resume, statistics tracking via SwiftData
- Privacy manifest, app icon, String Catalog, zero dependencies

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 07:33:52 -04:00

2.4 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

What This Project Is

SoliCards is a native SwiftUI solitaire card game for iOS 17+, iPadOS 17+, and macOS 14+. It was ported from a web-based JavaScript game (game-SoliCards/SoliCards.html) following the 7-phase workflow defined in PROMPT.md.

Build Commands

# Generate Xcode project (required after cloning or editing project.yml)
xcodegen generate

# Build for iOS Simulator
xcodebuild build -project SoliCards.xcodeproj -scheme SoliCards -destination 'platform=iOS Simulator,name=iPhone 16'

# Build for macOS
xcodebuild build -project SoliCards.xcodeproj -scheme SoliCards -destination 'platform=macOS' CODE_SIGN_IDENTITY=- CODE_SIGNING_REQUIRED=NO

# Run tests
xcodebuild test -project SoliCards.xcodeproj -scheme SoliCardsTests -destination 'platform=iOS Simulator,name=iPhone 16'

# Static analysis
xcodebuild analyze -project SoliCards.xcodeproj -scheme SoliCards -destination 'platform=iOS Simulator,name=iPhone 16'

Architecture

MVVM + Protocol-Oriented Strategy — see ARCHITECTURE.md for full details.

  • GameRules protocol with 3 conforming structs: KlondikeRules, SpiderRules, FreeCellRules
  • @Observable macro (not ObservableObject) for property-level SwiftUI observation
  • @MainActor on ViewModels and TimerService for Swift 6 concurrency safety
  • DragGesture + PreferenceKey frame hit-testing for card drag & drop (not onDrag/onDrop)
  • SwiftData for persistence (GameRecord, StatsRecord, PrefsRecord)
  • Zero external dependencies

Key Conventions

  • .xcodeproj is generated by xcodegen from project.yml — do not edit it by hand
  • Array.trailingSuffix(while:) extension replaces missing stdlib suffix(while:) — used in rules engines for face-up card runs
  • Card images are loaded from the asset catalog via platform-conditional helpers (UIImage/NSImage) in CardView
  • Sound playback is dispatched via nonisolated func playSound() to avoid @MainActor isolation on the audio path

Test Suite

57 tests across 12 suites. All tests are in SoliCardsTests/ using Swift Testing (@Test, #expect).

Key test coverage areas:

  • GameEngine/ — KlondikeRules, SpiderRules, FreeCellRules, MoveValidator, AutoCompleter, GameState
  • Models/ — Card, Deck, Difficulty, GameVariant, Rank, Suit