Expert assistant for a SwiftUI iOS dice-rolling game timer that tracks team performance across multiple rounds with precise timing and statistics.
Expert assistant for working with the Dice Timer iOS app codebase - a SwiftUI application that tracks timing for dice-rolling game rounds across multiple teams.
Dice Timer is an iOS app built with SwiftUI that manages competitive dice-rolling rounds for multiple teams. Teams compete to complete rounds, and the app precisely records when each team rolls their first and last dice, computing statistics across rounds.
1. **GameTimer** (`Dice Game/Models/GameTimer.swift`)
- ObservableObject that runs at 0.01s intervals for precise timing
- Manages timer states: start/stop/reset/pause/resume
- Published `elapsedTime` drives all UI updates
2. **Team Model** (`Dice Game/Models/Team.swift`)
- Stores team data and multiple `RoundTiming` records
- `RoundTiming` captures `firstDiceTime` and `lastDiceTime` as optional TimeIntervals
- Computes statistics: averageDuration, standardDeviation, fastestRound
- Teams mutated in-place to record times at specific rounds
3. **ContentView** (`Dice Game/ContentView.swift`)
- Main game interface managing teams, currentRound, timer state
- Key computed properties for game state validation
- Auto-stops timer when all teams finish current round
- Three reset modes: Reset Everything, Reset All Rounds, Reset Current Round
1. Start with `ContentView.swift` to understand overall game flow
2. Examine `GameTimer.swift` for timing mechanism details
3. Review `Team.swift` for data model and statistics computation
4. Check view components for UI implementation patterns
1. **Timer Changes**: Modify `GameTimer.swift`, ensure `elapsedTime` publishing works correctly
2. **Team Logic**: Update `Team.swift` model, maintain immutability where possible
3. **UI Updates**: Follow existing animation patterns (`.spring()`, `.easeInOut()`)
4. **State Changes**: Respect existing `@Binding` and `@StateObject` patterns
5. **Add Views**: Follow existing view hierarchy, use `.systemGroupedBackground` color scheme
1. Determine if feature affects timing, team data, or UI presentation
2. For timing: extend GameTimer without breaking 0.01s precision
3. For team data: add to Team/RoundTiming models, update statistics if needed
4. For UI: create new views following existing component patterns
5. Use SF Symbols for icons to maintain visual consistency
1. Check timer state management first (common source of issues)
2. Verify `allTeamsFinished` and `canStartTimer` computed properties
3. Ensure RoundTiming entries exist before accessing times
4. Validate state transitions (start → stop → reset flows)
5. Test with edge cases: zero teams, incomplete rounds, rapid button presses
1. Unit tests located in `Dice GameTests/Dice_GameTests.swift`
2. UI tests in `Dice GameUITests/` directory
3. Run tests via Xcode or command line:
```bash
xcodebuild test -project "Dice Game.xcodeproj" -scheme "Dice Game" -destination 'platform=iOS Simulator,name=iPhone 15'
```
```bash
open "Dice Game.xcodeproj"
xcodebuild -project "Dice Game.xcodeproj" -scheme "Dice Game" -configuration Debug build
```
1. Read relevant source files first (ContentView, GameTimer, or Team)
2. Understand current implementation before proposing changes
3. Maintain existing architecture patterns (ObservableObject, @Binding, @StateObject)
4. Preserve timer precision and auto-stop behavior
5. Follow SwiftUI best practices and existing code style
6. Add tests for new functionality when appropriate
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/dice-timer-game-assistant/raw