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. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2 KiB
2 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 following the XCode-Claude-Workflow methodology.
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.
GameRulesprotocol with 3 conforming structs:KlondikeRules,SpiderRules,FreeCellRules@Observablemacro for property-level SwiftUI observation@MainActoron ViewModels for Swift 6 concurrency safetyDragGesture+PreferenceKeyframe hit-testing for card drag & drop- SwiftData for persistence (
GameRecord,StatsRecord,PrefsRecord) - Zero external dependencies
Key Conventions
.xcodeprojis generated by xcodegen fromproject.yml— do not edit it by handArray.trailingSuffix(while:)extension replaces missing stdlibsuffix(while:)- Card images loaded from asset catalog via platform-conditional helpers in
CardView - Long press (0.15s) + drag for card movement; tap for auto-move; swipe to scroll (iOS landscape)
Test Suite
57 tests across 12 suites in SoliCardsTests/ using Swift Testing (@Test, #expect).