| name | voilog-ios-build-test |
| description | Automate VoiLog iOS build and test workflows using xcodebuild, SwiftLint, and bundle commands. Use when building iOS app, running tests, performing code quality checks, or asking about xcodebuild commands. |
| metadata | {"author":"VoiLog Team","version":"1.0.0","category":"development","tags":["ios","xcodebuild","swiftlint","testing"]} |
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
swiftlint
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
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:
xcrun simctl list devices
Error: SwiftLint not found
Cause: SwiftLint not installed or not in PATH
Solution:
brew install swiftlint
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 tests
ios/VoiLogUITests/ - UI tests
Common test files:
PlaylistListFeatureTests.swift - Playlist feature tests
- Add more as needed
Performance Tips
Speed up test runs
xcodebuild test \
-project ios/VoiLog.xcodeproj \
-scheme VoiLogTests \
-destination 'platform=iOS Simulator,name=iPhone 15' \
-enableCodeCoverage NO
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