gitmyhub

XcodeGen

Swift ★ 8.5k updated 2mo ago

A Swift command line tool for generating your Xcode project

XcodeGen generates Xcode project files from a simple YAML config so iOS and macOS teams can stop committing the notoriously merge-conflict-prone .xcodeproj file to version control.

SwiftSwift Package ManagerYAMLsetup: easycomplexity 2/5

XcodeGen is a command-line tool for iOS and macOS developers that generates Xcode project files from a human-readable configuration file. Xcode project files (the .xcodeproj package) are notoriously painful in team settings because they change every time a developer adds a file or tweaks a setting, and those changes create merge conflicts when multiple people work on the same codebase. XcodeGen sidesteps this by letting teams store a simple YAML or JSON spec in version control instead of the generated project file.

The spec describes the targets in your project (apps, frameworks, test targets), their deployment targets, source folders, build settings, dependencies, and schemes. When you run the tool, it reads that spec and your folder structure and produces a fresh .xcodeproj. You can regenerate the project at any time, and because the tool reads your file system directly, the groups and files shown in Xcode always match what is actually on disk. Adding a new file to a folder is enough; you do not need to also add it in Xcode.

Build settings can be shared across multiple targets using setting groups, which cuts down on repetition. Dependencies on other targets, Carthage frameworks, vendored frameworks, and Swift packages are all declared in the spec. Schemes for different environments, such as staging and production, can also be auto-generated.

XcodeGen is installed most simply via Homebrew with a single brew install command, or via the Mint package manager for Swift CLI tools. It can also be built from source using the Swift Package Manager. A cache flag lets you skip regeneration when the spec and file system have not changed since the last run, which keeps CI builds fast. The project is MIT-licensed.

Where it fits