How xcodesorg/xcodesapp works
Project type and purpose
• This is a native macOS desktop application (“Xcodes.app”) built with Swift and SwiftUI.
• Purpose: Provide a GUI for listing, downloading, installing, and switching between multiple Xcode versions and runtimes.
• Key modules: Frontend (SwiftUI UI layer), Backend (business logic, download orchestration, state management), XPC Helper for privileged operations, shared libraries (XcodesKit, AppleAPI), and build‐time tools (AcknowledgementsGenerator).
File structure
• Top level:
• AppCast folder and scripts for Sparkle AppCast generation and deployment
• Scripts/ for packaging, signing, notarization, build number bump
• Xcodes.xcodeproj – the main Xcode workspace
• Xcodes/ – the application source, subdivided into AcknowledgementsGenerator, AppleAPI, Backend, Frontend, Resources
• XcodesKit – a SwiftPM library with core models and services
• com.xcodesorg.xcodesapp.Helper – an XPC helper target
• Patterns:
• SwiftUI MVVMish pattern in Frontend (Views + state objects)
• Combine publishers in Backend for downloads and progress
• XPC to perform privileged installs
• SwiftPM for modular libraries (AppleAPI, XcodesKit)
• Config files: .github workflows (CI, release, appcast), scripts for packaging & notarization.
README for insights
• Architecture notes: mentions aria2 for fast multi-connection downloads, unxip for extraction, Apple API integration, Sparkle for updates.
• Dependencies: aria2, unxip, Sparkle, xcode-install & fastlane/spaceship inspiration.
Main components & relationships
a. Components
• Frontend (SwiftUI views)
• Backend (AppState, Downloader, NotificationManager, HelperClient)
• XPC Helper (privileged installer, code signing, launchd)
• Shared code libraries:
– XcodesKit (models: XcodeRelease, Runtime, shell wrappers)
– AppleAPI (HTTP client for Apple Developer endpoints)
• Build-time tools: AcknowledgementsGenerator (license aggregation)
• External services/tools: aria2c, unxip, Sparkle AppCast, Xcode-select system command, GitHub Actions
b. Interactions
• UI binds to Backend state via Combine/SwiftUI
• Backend calls AppleAPI to fetch release metadata
• Backend spawns aria2 or URLSession via Downloader → writes to disk
• Backend invokes HelperClient (XPC proxy) to perform privileged install/uninstall
• Helper service runs as privileged launchd, writes to /Applications, updates symlinks
• UI triggers Sparkle update flow (AppCast + sign_update script)
• Build scripts orchestrate AcknowledgementsGenerator → embed licenses → package → notarize → sign
c. Architectural patterns
• MVVM/MVC hybrid: Views observe AppState and Publishers
• Modular services: HTTP client (AppleAPI), shell wrappers (XcodesKit/Shell)
• Resilient downloads: resumable Combine publishers
• Privilege separation: main app + XPC helper
d. Key technologies
• Swift, SwiftUI, Combine
• Swift Package Manager for libraries
• XPC for privileged operations
• aria2c & unxip as external CLI tools
• Sparkle for in-app updates
• GitHub Actions CI & release workflows