by hmohamed01
开发者需要工具来高效地构建、测试和部署 Apple 平台应用程序。本技能提供命令行工作流,用于 Swift 包管理器、Xcode 项目管理、模拟器管理和代码签名。
1. 打开 Claude 聊天界面
2. 点击下方 "📋 复制" 按钮
3. 粘贴到 Claude 聊天框中并发送
4. 输入 "使用 swift-development 技能" 开始使用
=== swift-development 技能 === 作者: hmohamed01 描述: 开发者需要工具来高效地构建、测试和部署 Apple 平台应用程序。本技能提供命令行工作流,用于 Swift 包管理器、Xcode 项目管理、模拟器管理和代码签名。 使用方法: 1. 调用技能: "使用 swift-development 技能" 2. 提供相关信息: 根据技能要求提供必要参数 3. 查看结果: 技能会返回处理结果 示例: "使用 swift-development 技能,帮我分析一下这段代码"
这种方法适用于所有 Claude 用户,不需要安装额外工具。
coding
safe
xcode-select --installxcodebuild -version and swift --version# Use the included script for full setup
./scripts/new_package.sh MyLibrary --type library --ios --macos
# Or manually
swift package init --type library --name MyLibrary
# SPM packages
swift build
swift test
# Xcode projects
xcodebuild -workspace App.xcworkspace -scheme App \
-destination 'platform=iOS Simulator,name=iPhone 15' build
# Use included script for common options
./scripts/run_tests.sh --parallel --coverage
# Use included script
./scripts/format_and_lint.sh Sources/
# Check mode (CI)
./scripts/format_and_lint.sh --check
# Use included script
./scripts/simulator.sh list
./scripts/simulator.sh boot "iPhone 15"
./scripts/simulator.sh screenshot
./scripts/simulator.sh dark
# Debug build for simulator
xcodebuild -workspace App.xcworkspace -scheme App \
-destination 'platform=iOS Simulator,name=iPhone 15' \
build
# Release archive
xcodebuild archive \
-workspace App.xcworkspace -scheme App \
-archivePath ./build/App.xcarchive \
-configuration Release
# Export IPA (use templates from assets/ExportOptions/)
xcodebuild -exportArchive \
-archivePath ./build/App.xcarchive \
-exportPath ./build/export \
-exportOptionsPlist assets/ExportOptions/app-store.plist
# All tests
xcodebuild test -workspace App.xcworkspace -scheme App \
-destination 'platform=iOS Simulator,name=iPhone 15'
# Specific test
xcodebuild test -only-testing:AppTests/MyTestClass/testMethod
# With coverage
xcodebuild test -enableCodeCoverage YES \
-resultBundlePath ./TestResults.xcresult
# Install on booted simulator
xcrun simctl install booted ./Build/Products/Debug-iphonesimulator/App.app
# Launch
xcrun simctl launch booted com.company.app
These are Apple's official documentation links for manual browsing:
| Resource | URL |
|---|---|
| Swift Documentation | https://developer.apple.com/documentation/swift |
| SwiftUI | https://developer.apple.com/documentation/swiftui |
| Swift Concurrency | https://developer.apple.com/documentation/swift/concurrency |
| Swift Testing | https://developer.apple.com/documentation/testing |
Note: Apple's documentation sites are JavaScript SPAs and cannot be fetched programmatically with WebFetch.
Use these GitHub-based sources for live documentation fetching:
| Resource | URL |
|---|---|
| Swift Testing | https://github.com/apple/swift-testing |
| Swift Evolution Proposals | https://github.com/apple/swift-evolution/tree/main/proposals |
| Swift Compiler Docs | https://github.com/apple/swift/tree/main/docs |
| Swift Standard Library | https://github.com/apple/swift/tree/main/stdlib |
| Swift Async Algorithms | https://github.com/apple/swift-async-algorithms |
| Swift Collections | https://github.com/apple/swift-collections |
Use WebFetch to retrieve documentation from GitHub in these situations:
@Test, #expect, #require, traits, or parameterized testsHow to fetch: Use WebFetch with GitHub URLs:
https://github.com/apple/swift-testinghttps://raw.githubusercontent.com/apple/swift-testing/main/README.mdhttps://github.com/apple/swift-evolution/blob/main/proposals/0409-access-level-on-imports.mdExample prompt for WebFetch: "Extract the main features, macros, and usage examples from this documentation"
Detailed documentation for specific topics:
| Topic | File |
|---|---|
| SwiftUI patterns | references/swiftui-patterns.md |
| Testing patterns | references/testing-patterns.md |
| Swift 6 concurrency | references/concurrency.md |
| Architecture patterns | references/architecture.md |
| Best practices | references/best-practices.md |
| Swift Package Manager | references/spm.md |
| xcodebuild commands | references/xcodebuild.md |
| Simulator control | references/simctl.md |
| Code signing | references/code-signing.md |
| CI/CD setup | references/cicd.md |
| Troubleshooting | references/troubleshooting.md |
| Script | Purpose |
|---|---|
scripts/new_package.sh | Create new Swift package with config files |
scripts/run_tests.sh | Run tests with common options |
scripts/format_and_lint.sh | Format and lint Swift code |
scripts/simulator.sh | Quick simulator management |
| Asset | Purpose |
|---|---|
assets/Package.swift.template | Swift package template |
assets/.swiftformat | SwiftFormat configuration |
assets/.swiftlint.yml | SwiftLint configuration |
assets/ExportOptions/ | Archive export plist templates |
| Task | Command |
|---|---|
| Build package | swift build |
| Build release | swift build -c release |
| Run tests | swift test |
| Update deps | swift package update |
| List simulators | xcrun simctl list devices |
| Boot simulator | xcrun simctl boot "iPhone 15" |
| Install app | xcrun simctl install booted ./App.app |
| Format code | swiftformat . |
| Lint code | swiftlint |
# iOS Simulator
-destination 'platform=iOS Simulator,name=iPhone 15'
# macOS
-destination 'platform=macOS'
# Generic iOS (for archives)
-destination 'generic/platform=iOS'
View Count
0
Download Count
0
Favorite Count
0
Quality Score
81