SKILL.md
VoiLog iOS Build & Test
RULE: テストは必ず書く
実装後は必ず対応するテストを追加し、xcodebuild testでグリーンを確認してから完了とすること。
Quick Commands Reference
Setup Dependencies
bundle install
Build for Development
xcodebuild -project ios/VoiLog.xcodeproj \
-scheme VoiLogDevelop \
-configuration Debug
Build for Production
xcodebuild -project ios/VoiLog.xcodeproj \
-scheme VoiLog \
-configuration Release
Run All Tests
xcodebuild test \
-project ios/VoiLog.xcodeproj \
-scheme VoiLogTests \
-destination 'platform=iOS Simulator,name=iPhone 15'
Run Specific Test Class
xcodebuild test \
-project ios/VoiLog.xcodeproj \
-scheme VoiLogTests \
-destination 'platform=iOS Simulator,name=iPhone 15' \
-only-testing:VoiLogTests/PlaylistListFeatureTests
Code Quality Checks
cd ios
swiftlint --fix # Auto-fix issues
swiftlint # Check for violations
Workflow: Pre-Commit Checks
Run these commands before committing code:
Pre-Commit Checklist:
- [ ] Run SwiftLint fix
- [ ] Run SwiftLint check
- [ ] Run relevant tests
- [ ] Verify build succeeds
Step 1: Auto-fix SwiftLint Issues
cd ios && swiftlint --fix
Step 2: Check for Remaining Violations
cd ios && swiftlint
Step 3: Run Relevant Tests
# For feature changes, run specific test class
xcodebuild test \
-project ios/VoiLog.xcodeproj \
-scheme VoiLogTests \
-destination 'platform=iOS Simulator,name=iPhone 15' \
-only-testing:VoiLogTests/YourFeatureTests
Step 4: Verify Build
xcodebuild -project ios/VoiLog.xcodeproj \
-scheme VoiLogDevelop \
-configuration Debug
Common Test Patterns
TCA TestStore Pattern
@Test
func testFeature() async {
let store = TestStore(initialState: Feature.State()) {
Feature()
}
await store.send(.view(.buttonTapped)) {
$0.isLoading = true
}
await store.receive(.delegate(.completed))
}
Testing with Dependencies
@Test
func testWithRepository() async {
let store = TestStore(initialState: Feature.State()) {
Feature()
} withDependencies: {
$0.voiceMemoRepository = .mock
}
await store.send(.view(.loadData))
await store.receive(.dataLoaded(mockData))
}
Update Swift Packages
xcodebuild -resolvePackageDependencies -project ios/VoiLog.xcodeproj
Troubleshooting
Error: Build fails with package resolution error
Cause: Corrupted Swift package cache Solution:
rm -rf ~/Library/Caches/org.swift.swiftpm
xcodebuild -resolvePackageDependencies -project ios/VoiLog.xcodeproj
Error: Tests fail to start simulator
Cause: Simulator not available or corrupted state Solution:
# List available simulators
xcrun simctl list devices
# Reset simulator (in iOS Simulator app)
# Settings → Erase All Content and Settings
Error: SwiftLint not found
Cause: SwiftLint not installed or not in PATH Solution:
# Install via Homebrew
brew install swiftlint
# Or add to PATH if already installed
export PATH="/opt/homebrew/bin:$PATH"
Error: xcodebuild command not found
Cause: Xcode Command Line Tools not installed Solution:
xcode-select --install
Error: "No scheme named 'VoiLogTests'"
Cause: Test scheme not properly configured Solution:
- Open Xcode
- Product → Scheme → Manage Schemes
- Verify "VoiLogTests" is checked
Available Test Schemes
- VoiLogTests: All unit tests
- VoiLogUITests: UI tests (if available)
Test Organization
Tests are located in:
ios/VoiLogTests/- Unit testsios/VoiLogUITests/- UI tests
Common test files:
PlaylistListFeatureTests.swift- Playlist feature tests- Add more as needed
Performance Tips
Speed up test runs
# Run tests without code coverage (faster)
xcodebuild test \
-project ios/VoiLog.xcodeproj \
-scheme VoiLogTests \
-destination 'platform=iOS Simulator,name=iPhone 15' \
-enableCodeCoverage NO
Parallel testing
# Enable parallel testing
xcodebuild test \
-project ios/VoiLog.xcodeproj \
-scheme VoiLogTests \
-destination 'platform=iOS Simulator,name=iPhone 15' \
-parallel-testing-enabled YES
References
See CLAUDE.md for:
- Full xcodebuild command reference
- Available schemes
- SwiftLint configuration