A Swift command line tool for generating your Xcode project
Go to file
2017-09-25 13:34:11 +02:00
Assets remove old logos 2017-07-31 12:35:39 +02:00
docs Merge pull request #64 from yonaskolb/xcconfig 2017-09-24 20:32:53 +02:00
Fixtures add optional replace syntax when merging includes 2017-09-25 13:34:11 +02:00
Formula [homebrew-disable-sandbox] Disable sandbox when building XcodeGen for Homebrew 2017-09-23 12:49:03 +02:00
SettingPresets set default version of generated targets to Swift 4.0 2017-09-20 16:10:30 +02:00
Sources add optional replace syntax when merging includes 2017-09-25 13:34:11 +02:00
Tests add optional replace syntax when merging includes 2017-09-25 13:34:11 +02:00
.gitignore Test project 2017-07-19 18:33:43 +02:00
.travis.yml upgrade to Swift 4 2017-09-14 00:48:57 +02:00
CHANGELOG.md update changelog 2017-09-25 10:53:04 +02:00
format_code.sh add format code script 2017-07-31 12:32:50 +02:00
LICENSE Create LICENSE 2017-07-22 22:04:38 +02:00
Makefile update makefile 2017-09-23 17:59:18 +02:00
Package.resolved upgrade to xcodeproj 0.1.2 2017-09-14 21:28:09 +02:00
Package.swift upgrade to xcodeproj 0.1.2 2017-09-14 21:28:09 +02:00
README.md [homebrew-disable-sandbox] Disable sandbox when building XcodeGen for Homebrew 2017-09-23 12:49:03 +02:00

XcodeGen

XcodeGen

XcodeGen is a command line tool that generates your Xcode project using your folder structure and a simple project spec.

The project spec is a YAML or JSON file that defines your targets, configurations, schemes and custom build settings. All you source directories are automatically parsed and referenced appropriately while preserving your folder structure. Sensible defaults are used in many places, so you only need to customize what is needed.

  • Easy configuration of projects which is human readable and git friendly
  • Groups in Xcode are always synced to your directories on disk
  • Create projects on demand and remove your .xcodeproj file from git, which means no merge conflicts!
  • Easily copy and paste files and directories without having to edit anything in xcode
  • Share build settings across multiple targets with build setting groups
  • Automatically generate Schemes for different environments like test and production
  • Easily create new projects with complicated setups on demand without messing around with Xcode
  • Generate from anywhere including Continuous Delivery servers
  • Distribute your spec amongst multiple files for easy sharing and overriding

Given a very simple project spec file like this:

name: My Project
targets:
  MyApp:
    type: application
    platform: iOS
    sources: MyApp
    settings:
      PRODUCT_BUNDLE_IDENTIFIER: com.myapp
    dependencies:
      - target: MyFramework
  MyFramework:
    type: framework
    platform: iOS
    sources: MyFramework

A project would be created with 2 connected targets, with all the required configurations and build settings. See the Project Spec documentation for all the options you can specify.

Installing

Make sure Xcode 9 is installed first.

Make

$ git clone https://github.com/yonaskolb/XcodeGen.git
$ cd XcodeGen
$ make

Homebrew

$ brew tap yonaskolb/XcodeGen https://github.com/yonaskolb/XcodeGen.git
$ brew install XcodeGen

Swift Package Manager

Use CI tool

$ git clone https://github.com/yonaskolb/XcodeGen.git
$ cd XcodeGen
$ swift run

Use as dependency

Add the following to your Package.swift file's dependencies:

.Package(url: "https://github.com/yonaskolb/XcodeGen.git", majorVersion: 0)

And then import wherever needed: import XcodeGenKit

Usage

Simply run:

$ xcodegen

This will look for a project spec in the current directory called project.yml

Use xcodegen help to see the list of options:

  • --spec: An optional path to a .yml or .json project spec
  • --project: An optional path to a directory where the project will be generated. By default this is the current directory

Editing

$ git clone https://github.com/yonaskolb/XcodeGen.git
$ cd XcodeGen
$ swift package generate-xcodeproj

This use Swift Project Manager to create an xcodeproj file that you can open, edit and run in Xcode, which makes editing any code easier.

If you want to pass any required arguments when running in XCode, you can edit the scheme to include launch arguments.

Project Spec

See Project Spec documentation here

Attributions

This tool is powered by:

Inspiration for this tool came from:

Contributions

Pull requests and issues are welcome

License

XcodeGen is licensed under the MIT license. See LICENSE for more info.