hmohamed01/swift-development
Overview
This skill provides end-to-end Swift development tooling for building, testing, and deploying iOS and macOS apps from the command line. It wraps common xcodebuild, SwiftPM, simctl, linting/formatting, and code-signing workflows into reusable scripts and guidance. Use it to speed up local development, CI pipelines, and reproducible release builds.
How this skill works
The skill exposes scripts and command examples to initialize Swift packages, build SPM packages and Xcode projects, run XCTest-based tests, and manage simulators via simctl. It also automates formatting and linting with SwiftFormat/SwiftLint, handles code signing and archive/export steps, and points to reference docs and templates for ExportOptions and configuration files. When detailed API behavior is needed, the skill recommends fetching GitHub-based docs for Swift Testing, Swift Evolution, and related repositories.
When to use it
- Create a new Swift package or scaffold an app module from the command line
- Build and run tests for SPM packages and Xcode workspaces locally or in CI
- Archive, export, and prepare IPAs with consistent export option templates
- Manage iOS simulators: list, boot, install apps, take screenshots, toggle dark mode
- Format and lint code automatically or enforce check mode in CI
- Implement or review Swift 6 concurrency, SwiftUI MVVM, or persistence setups (Core Data / SwiftData)
Best practices
- Verify Xcode and CLI tools versions before running builds (xcodebuild -version; swift --version)
- Use the included scripts to standardize options across local and CI runs (scripts/run_tests.sh, scripts/format_and_lint.sh)
- Keep ExportOptions templates in assets/ExportOptions/ and update them per distribution target
- Run format/lint in check mode on CI to prevent style regressions
- Prefer Swift Package Manager for libraries; use workspace-based xcodebuild commands for app targets
- Use simulator scripts to reproduce test environments and avoid relying on local GUI interactions
Example use cases
- Initialize a library package and run swift test with coverage for CI
- Debug failing UI tests by booting a specific iPhone simulator and capturing screenshots
- Create a release archive and export an IPA using predefined ExportOptions plist
- Apply SwiftFormat and SwiftLint across Sources/ and fail CI if diffs exist
- Implement async/await patterns and actors in a new Swift 6 module with guidance from the included concurrency references
FAQ
macOS with Xcode 15+ (Xcode 16+ for Swift 6 features) and Xcode Command Line Tools. Verify with xcodebuild -version and swift --version.
Can I run these scripts in CI?
Yes. Scripts are designed for deterministic CLI usage and include check modes for format/lint and export templates for reproducible archives suitable for CI pipelines.