A Swift command line tool for generating your Xcode project
Go to file
2017-08-27 11:53:16 +02:00
Assets remove old logos 2017-07-31 12:35:39 +02:00
docs automatically generate carthage framework search paths 2017-08-26 23:43:41 +02:00
Fixtures change SDK version defaults 2017-08-26 23:59:37 +02:00
Formula update homebrew formula 2017-08-25 16:55:31 +02:00
SettingPresets change SDK version defaults 2017-08-26 23:59:37 +02:00
Sources change Target.Dependency to a struct with embed 2017-08-27 11:53:16 +02:00
Tests rename setting presets to setting groups 2017-08-26 18:38:39 +02:00
.gitignore Test project 2017-07-19 18:33:43 +02:00
.travis.yml Create .travis.yml 2017-07-24 19:35:40 +02:00
CHANGELOG.md 0.4.0 changelog 2017-08-25 16:44:45 +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 copy SettingPresets in makefile 2017-08-24 01:22:51 +02:00
Package.pins change xcodeproj from carambalabs to swift-xcode 2017-08-25 16:34:16 +02:00
Package.swift change xcodeproj from carambalabs to swift-xcode 2017-08-25 16:34:16 +02:00
README.md show multi platform example in Readme 2017-08-27 00:01:49 +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

Given a very simple project spec file like this:

name: My Project
targets:
  - name: MyApp
    type: application
    platform: iOS
    sources: MyApp
    settings:
      INFOPLIST_FILE: MyApp/Info.plist
      PRODUCT_BUNDLE_IDENTIFIER: com.myapp
    dependencies:
      - target: MyFramework
  - name: MyFramework
    type: framework
    platform: [iOS, tvOS]
    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 8.3 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 build -c release
$ .build/release/XcodeGen

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 xcodegen.yml

Use xcodegen help to see the list of options:

  • --spec: This is an optional path to a .yml or .json project spec
  • --project: This is an optional path the generated xcode project file. If it is left out, the file will be written to the same directory as the spec, and with the name included in the spec

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.