Automate VoiLog iOS build and test workflows using xcodebuild, SwiftLint, and bundle commands...
RULE: ใในใใฏๅฟ ใๆธใ ๅฎ่ฃ ๅพใฏๅฟ ใๅฏพๅฟใใใในใใ่ฟฝๅ ใใ
xcodebuild testใงใฐใชใผใณใ็ขบ่ชใใฆใใๅฎไบใจใใใใจใ
bundle install
xcodebuild -project ios/VoiLog.xcodeproj \
-scheme VoiLogDevelop \
-configuration Debug
xcodebuild -project ios/VoiLog.xcodeproj \
-scheme VoiLog \
-configuration Release
xcodebuild test \
-project ios/VoiLog.xcodeproj \
-scheme VoiLogTests \
-destination 'platform=iOS Simulator,name=iPhone 15'
xcodebuild test \
-project ios/VoiLog.xcodeproj \
-scheme VoiLogTests \
-destination 'platform=iOS Simulator,name=iPhone 15' \
-only-testing:VoiLogTests/PlaylistListFeatureTests
cd ios
swiftlint --fix # Auto-fix issues
swiftlint # Check for violations
Run these commands before committing code:
Pre-Commit Checklist:
- [ ] Run SwiftLint fix
- [ ] Run SwiftLint check
- [ ] Run relevant tests
- [ ] Verify build succeeds
cd ios && swiftlint --fix
cd ios && swiftlint
# 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
xcodebuild -project ios/VoiLog.xcodeproj \
-scheme VoiLogDevelop \
-configuration Debug
@Test
func testFeature() async {
let store = TestStore(initialState: Feature.State()) {
Feature()
}
await store.send(.view(.buttonTapped)) {
$0.isLoading = true
}
await store.receive(.delegate(.completed))
}
@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))
}
xcodebuild -resolvePackageDependencies -project ios/VoiLog.xcodeproj
Cause: Corrupted Swift package cache Solution:
rm -rf ~/Library/Caches/org.swift.swiftpm
xcodebuild -resolvePackageDependencies -project ios/VoiLog.xcodeproj
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
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"
Cause: Xcode Command Line Tools not installed Solution:
xcode-select --install
Cause: Test scheme not properly configured Solution:
Tests are located in:
ios/VoiLogTests/ - Unit testsios/VoiLogUITests/ - UI testsCommon test files:
PlaylistListFeatureTests.swift - Playlist feature tests# Run tests without code coverage (faster)
xcodebuild test \
-project ios/VoiLog.xcodeproj \
-scheme VoiLogTests \
-destination 'platform=iOS Simulator,name=iPhone 15' \
-enableCodeCoverage NO
# Enable parallel testing
xcodebuild test \
-project ios/VoiLog.xcodeproj \
-scheme VoiLogTests \
-destination 'platform=iOS Simulator,name=iPhone 15' \
-parallel-testing-enabled YES
See CLAUDE.md for: