Package.swift in Xcode.
Prerequisites
- macOS 14+ (Sonoma)
- Xcode 16+ with command line tools installed
- Swift 6.2+ (included with Xcode)
- Optional: SwiftFormat and SwiftLint for code style
Quick Build
Ad-hoc Signing
If you don’t have an Apple Developer account, use ad-hoc signing:Ad-hoc signed builds won’t receive Sparkle updates and will require keychain permissions on each rebuild since the signature changes.
Development Loop
The fastest way to iterate on changes:Options
Running Tests
Run the full test suite:Tests/CodexBarTests/- macOS-specific testsTestsLinux/- Linux CLI tests
Build Artifacts
SwiftPM places build outputs in.build/:
package_app.sh script assembles these into CodexBar.app:
Swift 6 Concurrency
CodexBar enables strict concurrency checking:- All code must be Sendable-safe
- Explicit
@MainActorrequired for UI code - Data races are caught at compile time
- Use
@Observableinstead ofObservableObject
Architecture-Specific Builds
By default, builds target the host architecture. To build for specific architectures:package_app.sh script uses lipo to create universal binaries when multiple architectures are built.
Code Style
CodexBar enforces consistent formatting:Style Guidelines
- 4-space indentation
- 120-character line limit
- Explicit
selfis intentional (do not remove) - Maintain existing
// MARK:organization
Cleaning Build Artifacts
Force a clean build:Troubleshooting
App won’t launch after building
- Check Console.app → User Reports for crash logs
- Verify code signature:
codesign --verify --deep --verbose CodexBar.app - Try ad-hoc signing:
CODEXBAR_SIGNING=adhoc ./Scripts/package_app.sh
”App is damaged” dialog
- Extended attributes broke code seal:
xattr -cr CodexBar.app - Rebuild with clean attributes:
./Scripts/package_app.sh
Keychain prompts on every launch
- Ad-hoc signing changes the signature each build
- Use a development certificate or add CodexBar to Keychain Access → item → Access Control
Tests fail with “No such module”
- Clean and rebuild:
swift package clean && swift build - Ensure you’re using Xcode 16+ command line tools
Next Steps
- Read Architecture to understand module structure
- Review Contributing Guidelines before submitting changes
- See RELEASING.md for release process details
