---
description: Verify iOS/mobile code compiles, all files are in Xcode targets, and passes quality checks
---

# Mobile Code Quality — PeakPulse

## Steps

1. Ensure working tree is clean:
// turbo
```bash
cd /Users/sd9235/code/mygh/learning_ai_peakpulse && git status --short
```

2. Generate Xcode project from project.yml:
```bash
cd /Users/sd9235/code/mygh/learning_ai_peakpulse/ios && xcodegen generate
```

3. Build PeakPulse target (iOS Simulator):
```bash
cd /Users/sd9235/code/mygh/learning_ai_peakpulse/ios && xcodebuild -project PeakPulse.xcodeproj -scheme PeakPulse -destination 'platform=iOS Simulator,name=iPhone 16' -quiet build
```

4. Build PeakPulseTests target:
```bash
cd /Users/sd9235/code/mygh/learning_ai_peakpulse/ios && xcodebuild -project PeakPulse.xcodeproj -scheme PeakPulse -destination 'platform=iOS Simulator,name=iPhone 16' -quiet test
```

5. Check for print() statements (should use os.Logger instead):
// turbo
```bash
grep -rn "print(" /Users/sd9235/code/mygh/learning_ai_peakpulse/ios/PeakPulse/ --include="*.swift" | grep -v "// print" | grep -v "/// " || echo "No print() found — OK"
```

6. Check for force unwraps:
// turbo
```bash
grep -rn '![^=]' /Users/sd9235/code/mygh/learning_ai_peakpulse/ios/PeakPulse/ --include="*.swift" | grep -v 'IBOutlet' | grep -v '// !' | grep -v '!=' | grep -v '!//' | head -20 || echo "No force unwraps found — OK"
```

7. Verify all Swift files are under ios/:
// turbo
```bash
find /Users/sd9235/code/mygh/learning_ai_peakpulse/ios -name "*.swift" | wc -l
```

8. Check entitlements file has required keys:
// turbo
```bash
cat /Users/sd9235/code/mygh/learning_ai_peakpulse/ios/PeakPulse/PeakPulse.entitlements
```

## Key Files
- `ios/project.yml` — XcodeGen project spec
- `ios/PeakPulse/PeakPulse.entitlements` — App entitlements
- `ios/PeakPulse/Theme/PeakPulseTheme.swift` — Design tokens

## Troubleshooting
| Issue | Fix |
|-------|-----|
| ByteLystPlatformSDK not found | Ensure `../../learning_ai_common_plat/packages/swift-platform-sdk/` exists |
| xcodegen not installed | `brew install xcodegen` |
| Build fails on Simulator | Check deployment target is iOS 17.0 |
