$ show yonaskolb/XcodeGen
XcodeGen is a command-line tool written in Swift that generates Xcode project files (.xcodeproj) from a declarative YAML or JSON specification (typically project.yml). It eliminates the need to manually manage Xcode project files by deriving the project structure from the filesystem and a concise spec, supporting all major Apple platforms (iOS, macOS, tvOS, watchOS, visionOS) and a wide range of product types including applications, frameworks, libraries, extensions, App Clips, and more. The tool integrates with Swift Package Manager, Carthage, and CocoaPods, and can generate schemes, breakpoints, Info.plist files, and build settings from layered presets. The architecture is modular: the ProjectSpec module defines the domain models and parsing logic for the spec format; XcodeGenKit contains the core generation logic (PBXProj generation, scheme generation, source file organization, settings resolution); XcodeGenCLI provides the command-line interface using SwiftCLI; and XcodeGenCore offers utility components like globbing, atomic properties, and path extensions. The tool is designed for automation and CI workflows, with caching support and pre/post generation commands. The codebase is well-structured with clear separation of concerns, extensive test coverage (unit tests, fixture-based golden tests, performance tests), and active maintenance. It demonstrates strong Swift engineering practices including protocol-oriented design, value types, and functional patterns. While the project is mature and widely adopted (over 8,800 stars), some areas like test fixtures are large and tightly coupled to specific Xcode versions, requiring periodic updates.
The LLM identified 3 files worth highlighting for reuse:
A custom glob implementation that supports Bash v3/v4 and Gradle-style glob behaviors. It is self-contained (only depends on Foundation and PathKit) and can be extracted as a standalone library for file pattern matching in any Swift project. The implementation handles recursive patterns, brace expansion, and platform-specific path separators, demonstrating non-trivial string processing and filesystem traversal logic.
A Swift property wrapper (@Atomic) that provides thread-safe read/write access to a value using os_unfair_lock. It is a minimal, self-contained utility (less than 50 lines) that can be reused in any Swift project requiring synchronized access to shared state. The implementation is efficient and correct, avoiding common pitfalls like lock contention or priority inversion.
A template resolution engine that supports recursive variable substitution (e.g., ${target_name}, ${platform}) and attribute-based templates. It is used to DRY up target and scheme definitions in the project spec. The logic is isolated to a single file with minimal dependencies on other ProjectSpec types, making it extractable as a general-purpose template engine for configuration files. It handles nested templates, cycle detection, and merge order rules.