Skip to content

Repository files navigation

xcodegen-templates

CI License: Apache 2.0 Platforms

A reusable set of XcodeGen target templates covering the common concerns of building apps for Apple platforms — macOS, iOS, tvOS, and beyond.

The idea

Every Apple target repeats the same boilerplate: platform settings, linting, build-number stamping, code signing. Instead of copy-pasting that into every project.yml, this repo captures each concern as a small, composable XcodeGen target template. A consuming target then assembles itself by listing the features it needs:

targets:
  MyApp:
    type: application
    platform: macOS
    templates: [Base, CodeSignAuto, SwiftLint, BuildNumberAutoIncrement]
    sources: [src]

Available templates

Each template lives in a *.yml at the repo root, is pulled in with include:, and is referenced by name in a target's templates: [...].

Template File Concern
Base Base.yml Common, platform-scoped build settings (previews, dead-code stripping, script sandboxing) via a Common settingGroup with [sdk=…] conditions — works for single- and multi-platform targets.
CodeSignAuto CodeSignAuto.yml Automatic (Xcode-managed) signing: CODE_SIGN_STYLE + DEVELOPMENT_TEAM.
CodeSignDevID CodeSignDevID.yml Per-config identity: Apple Development (Debug) / Developer ID Application (Release), manual style.
SwiftLint SwiftLint.yml Debug-only SwiftLint pre-build phase (via mise).
BuildNumber BuildNumber.yml MARKETING_VERSION / CURRENT_PROJECT_VERSION from a committed Version.xcconfig (static — does not modify the file).
BuildNumberAutoIncrement BuildNumber.yml Same as BuildNumber, plus a pre-build script that increments BUILD_NUMBER (+1) on each Debug build. Use instead of BuildNumber.

Getting started

This repo is consumed as a git submodule of your app / workspace, with mise (toolchain) and direnv (per-project env) wiring paths via environment variables — no symlinks.

git submodule add git@github.com:BorisVanin/xcodegen-templates.git xcodegen-templates

Full setup (the .envrc, including templates, Version.xcconfig, generating) is in docs/INSTALLATION.md. Converting an existing project.yml onto the templates concern-by-concern is covered in CLAUDE.md (also read automatically by Claude Code when this is a submodule).

Building

Generate and build through the per-project Makefile (make debug / release / open / clean), including the app+module and installer flows — see docs/BUILDING.md.

Examples

Each example has a .envrc-example — copy it to .envrc, set your Team ID, direnv allow.

  • examples/app-macos — minimal SwiftUI macOS app using the templates.
  • examples/complexMyApp links a MyModule framework (separate project via projectReferences), sharing one Version.xcconfig, plus a Developer ID .pkg installer under examples/complex/installer/.

Repository layout

.
├── README.md
├── CLAUDE.md                  # usage + migration guide (for humans and Claude)
├── LICENSE                    # Apache-2.0
├── Base.yml / CodeSignAuto.yml / CodeSignDevID.yml / SwiftLint.yml / BuildNumber.yml
├── mise.toml                  # pinned xcodegen + swiftlint
├── docs/
│   ├── INSTALLATION.md        # using the templates in your project
│   └── BUILDING.md            # building with the Makefiles
└── examples/
    ├── app-macos/             # single-window SwiftUI macOS app, fully templated
    └── complex/               # app + framework module (projectReference) + .pkg installer

Requirements

macOS with Xcode, plus mise (brew install mise) and direnv (brew install direnv). Details in docs/INSTALLATION.md.

License

Apache-2.0.

About

Composable XcodeGen target templates for Apple platforms: base settings, SwiftLint, build-number stamping, and code signing as reusable, mix-and-match building blocks. Consumed as a git submodule.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors