CLAUDE.md cho app iOS viết bằng Swift
Chỉ dẫn cho Claude về cách build và test app iOS từ dòng lệnh bằng xcodebuild, cùng quy ước SwiftUI và concurrency. Đổi tên scheme và máy giả lập cho đúng project của bạn.
Đã thử với Claude Code 2.1.329
Chỗ cần điền
{{app_name}}Tên appví dụPantry{{scheme}}Tên scheme trong Xcodeví dụPantry{{simulator}}Tên máy giả lập để chạy test (xem bằng `xcrun simctl list devices`)ví dụiPhone 17
CLAUDE.md
# {{app_name}}
iOS app in Swift and SwiftUI.
## Commands
- Build: `xcodebuild -scheme {{scheme}} -destination 'platform=iOS Simulator,name={{simulator}}' build`
- Test: `xcodebuild -scheme {{scheme}} -destination 'platform=iOS Simulator,name={{simulator}}' test`
- Lint: `swiftlint`
Build and run the tests before saying a task is done. If the build fails, read the first
error in the log, not the last.
## Conventions
- SwiftUI views stay small; move logic into `@Observable` models.
- Mark UI code `@MainActor`; use `async`/`await`, not completion handlers.
- No force unwraps (`!`) outside tests; handle the nil case.
- User-facing text goes through the String Catalog (`Localizable.xcstrings`).
## Do not
- Edit `*.xcodeproj` / `project.pbxproj` by hand unless asked; describe the change instead.
- Change signing, bundle identifiers or entitlements.
- Add a Swift package without saying why.
CLAUDE.md
# Pantry
iOS app in Swift and SwiftUI.
## Commands
- Build: `xcodebuild -scheme Pantry -destination 'platform=iOS Simulator,name=iPhone 17' build`
- Test: `xcodebuild -scheme Pantry -destination 'platform=iOS Simulator,name=iPhone 17' test`
- Lint: `swiftlint`
Build and run the tests before saying a task is done. If the build fails, read the first
error in the log, not the last.
## Conventions
- SwiftUI views stay small; move logic into `@Observable` models.
- Mark UI code `@MainActor`; use `async`/`await`, not completion handlers.
- No force unwraps (`!`) outside tests; handle the nil case.
- User-facing text goes through the String Catalog (`Localizable.xcstrings`).
## Do not
- Edit `*.xcodeproj` / `project.pbxproj` by hand unless asked; describe the change instead.
- Change signing, bundle identifiers or entitlements.
- Add a Swift package without saying why.