Swiftpack.co - Package - tuist/XcodeProj


Swift Package Manager Release Code Coverage Slack License

XcodeProj is a library written in Swift for parsing and working with Xcode projects. It's heavily inspired in CocoaPods XcodeProj and xcode.

Projects Using XcodeProj

| Project | Repository | | -------- | -------------------------------------------------------------------------------------- | | Tuist | github.com/tuist/tuist | | Sourcery | github.com/krzysztofzablocki/Sourcery | | ProjLint | github.com/JamitLabs/ProjLint | | XcodeGen | github.com/yonaskolb/XcodeGen | | xspm | gitlab.com/Pyroh/xspm |

If you are also leveraging XcodeProj in your project, feel free to open a PR to include it in the list above.


Swift Package Manager

Add the dependency in your Package.swift file:

let package = Package(
    name: "myproject",
    dependencies: [
        .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "7.5.0")),
    targets: [
            name: "myproject",
            dependencies: ["XcodeProj"]),


Only macOS

# Cartfile
github "tuist/xcodeproj" ~> 7.5.0


pod 'xcodeproj', '~> 7.5.0'


Using swift-sh you can automate project-tasks using scripts, for example we can make a script that keeps a project’s version key in sync with the current git tag that represents the project’s version:

#!/usr/bin/swift sh
import Foundation
import XcodeProj  // @tuist ~> 7.5.0
import PathKit

guard CommandLine.arguments.count == 3 else {
    let arg0 = Path(CommandLine.arguments[0]).lastComponent
    fputs("usage: \(arg0) <project> <new-version>\n", stderr)

let projectPath = Path(CommandLine.arguments[1])
let newVersion = CommandLine.arguments[2]
let xcodeproj = try XcodeProj(path: projectPath)

for conf in xcodeproj.pbxproj.buildConfigurations where conf.buildSettings[key] != nil {
    conf.buildSettings[key] = newVersion

try xcodeproj.write(path: projectPath)

You could then store this in your repository, for example at scripts/set-project-version and then run it:

$ scripts/set-project-version ./App.xcodeproj 1.2.3
$ git add App.xcodeproj
$ git commit -m "Bump version"
$ git tag 1.2.3

Future adaption could easily include determining the version and bumping it automatically. If so, we recommend using a library that provides a Version object.

Documentation 📝

Want to start using XcodeProj? Start by digging into our documentation which will help you get familiar with the API and get to know more about the Xcode projects structure.

References 📚


  1. Git clone the repository git@github.com:tuist/xcodeproj.git.
  2. Generate xcodeproj with swift package generate-xcodeproj.
  3. Open XcodeProj.xcodeproj.


XcodeProj is released under the MIT license. See LICENSE for details.

Open source

Tuist is a proud supporter of the Software Freedom Conservacy

Become a Conservancy Supporter!


Stars: 1071
Help us keep the lights on



7.5.0 - Nov 13, 2019


  • Provide default build settings for unit and ui test targets https://github.com/tuist/XcodeProj/pull/501 by @kwridan
  • Remove "Shell" Carthage dependency from project manifest as it's no longer used https://github.com/tuist/XcodeProj/pull/505 by @kwridan

7.4.0 - Nov 9, 2019


  • Update list of recognized file extensions https://github.com/tuist/XcodeProj/pull/500 by @dflems

7.3.0 - Nov 6, 2019


  • Update BuildSettingsProvider to include extension settings https://github.com/tuist/XcodeProj/pull/497 by @kwridan
  • Remove the dependency with the Swift Package Manager https://github.com/tuist/XcodeProj/pull/499 by @elliottwilliams

7.2.2 - Oct 30, 2019


  • Make test plans deserialise correctly https://github.com/tuist/XcodeProj/pull/496 by @adamkhazi

7.2.1 - Oct 29, 2019


  • Make test plans optional by https://github.com/tuist/XcodeProj/commit/c15034948a2a132bf559f14d3c6b4d1b73749663 @pepibumur