Swiftpack.co - Package - tuist/xcodeproj


CircleCI Swift Package Manager Release Code Coverage Slack License Say Thanks! Join the community on Spectrum

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

This project is a fork and evolution from xcproj

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 |

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: "6.4.0")),
    targets: [
            name: "myproject",
            dependencies: ["xcodeproj"]),


Only macOS

# Cartfile
github "tuist/xcodeproj" ~> 6.4.0


pod 'xcodeproj', '~> 6.4.0'

Migration Guides

xcodeproj 6

xcodeproj 6 is the final step towards hiding the Xcode project implementation details. One of those details was the object unique identifiers, which you used to manage yourself with previous versions. Now, xcodeproj does it for you, so you don't have to pass them around to set dependencies between objects.

This improvement makes the API easier, safer and more convenient, but at the cost of introducing some breaking changes in the library. If want to migrate your project to use xcodeproj 6, these are the things that you should look at:

  • PBXObjectReference is an internal class now. Object references to other objects are attributes with the type of the object that is being referred. For example, a XCConfigurationList object has an attribute buildConfigurations of type XCBuildConfiguration. Adding a new configuration is as easy as calling list.buildConfigurations.append(config).
  • Note that object references have different types of optionals based on the type of attribute:
    • Implicitly unwrapped optional: When the attribute is required by Xcode. Example
    • Explicitly unwrapped optional: When the attribute is optional by Xcode. Example
  • PBXObjects has also been made internal. It was exposed through the attribute objects on the PBXProj class. If you used to use this class for adding, removing, or getting objects, those methods have been moved to the PBXProj class - Public helpers

And yes, in case you are wondering, it fully supports Xcode 10 🎉

xcodeproj 5

xcodeproj 5 is a major release with important changes in the API focused on making it more convenient, and simplify the references handling. This version hasn't been officially released yet but you can already start updating your project for the new version. These are the changes you'd need to make in your projects:

  • xcproj has been renamed to xcodeproj so you need to update all your import statements to use the new name.
  • There's no support for Carthage nor CocoaPods anymore, if you were using them for fetching xcodeproj, you can use the Swift Package Manager and manually setup the dependency.
  • We've replaced Path with AbsolutePath and RelativePath from the Swift Package Manager's Basic framework. You might need to change some of the usages to use the new type.
  • Reference attributes have been renamed to use the naming convention attributeReference where attribute is the name of the attribute. If you are interested in materializing the reference to get the object, objects provide convenient getters that you can use for that purpose. Those getters throw if the object is not found in the project.

There are some useful additions to the API that you can check out on the CHANGELOG.

One of those additions is an improvement on how references are managed. When new objects are added to the project, you get the object reference. The reference is an instance that should be used to refer that object from any other. The value of that reference is an implementation detail that has been abstracted away from you.


You can check out the documentation on the following link. The documentation is automatically generated in every release by using Jazzy from Realm.

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.

FOSSA Status


Become a backer and show your support to our open source project.

Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer


Does your company use Tuist? Ask your manager or marketing team if your company would be interested in supporting our project. Support will allow the maintainers to dedicate more time for maintenance and new features for everyone. Also, your company's logo will show on GitHub and on our site - who doesn't want a little extra exposure? Here's the info

Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer Tuist Backer

Open source

Tuist is a proud supporter of the Software Freedom Conservacy

Become a Conservancy Supporter!


Stars: 858
Help us keep the lights on


Used By



6.4.0 - Jan 6, 2019


  • Added projReferenceFormat to PBXOutputSettings to allow changing the output format of generated references. withPrefixAndSuffix will give the legacy behaviour xcode will generate 32 character references as XCode does. https://github.com/tuist/xcodeproj/pull/345 by @samskiter.
  • Danger https://github.com/tuist/xcodeproj/pull/357 by @pepibumur.
  • Support for WorkspaceSettings https://github.com/tuist/xcodeproj/pull/359 by @pepibumur.

6.3.0 - Oct 18, 2018


  • Added parallelizable and randomExecutionOrdering attributes to XCScheme.TestableReference https://github.com/tuist/xcodeproj/pull/340 by @alvarhansen.


  • Fixed possible generated UUID conflicts https://github.com/tuist/xcodeproj/pull/342 by @yonaskolb.
  • Fixed not working PBXFileElement.fullPath(sourceRoot:) method https://github.com/tuist/xcodeproj/pull/343 by @Vyeczorny.

6.2.0 - Oct 12, 2018


  • Carthage and CocoaPods support https://github.com/tuist/xcodeproj/pull/339 by @pepibumur.


  • Improved writing performance https://github.com/tuist/xcodeproj/pull/336 https://github.com/tuist/xcodeproj/pull/337 https://github.com/tuist/xcodeproj/pull/338 by @yonaskolb.
  • Replaced Swift Package Manager dependency with PathKit https://github.com/tuist/xcodeproj/pull/334 by @yonaskolb.

6.1.0 - Oct 10, 2018


  • Added ability to pass in a PBXObject into the PBXProject.targetAttributes dictionary, which will be encoded into its UUID. Can be used for TestTargetID https://github.com/tuist/xcodeproj/pull/333 by @yonaskolb.


  • Changed XCScheme.BuildableReference init to make blueprint a PBXObject and added a setBlueprint(:) function https://github.com/tuist/xcodeproj/pull/320 by @yonaskolb.
  • Bump AEXML version to 4.3.3 https://github.com/tuist/xcodeproj/pull/310 by @pepibumur.
  • Improves performance of object references https://github.com/tuist/xcodeproj/pull/332 by @yonaskolb.
  • Prefix reference with object type acronym. eg. PBXFileReference becomes FR_XXXXXXXXXXXXXXXXX https://github.com/tuist/xcodeproj/pull/332 by @yonaskolb.
  • Add TEMP prefix to temporary unfixed reference values https://github.com/tuist/xcodeproj/pull/332 by @yonaskolb.


  • Fixed written order of scheme attributes in Swift 4.2 https://github.com/tuist/xcodeproj/pull/325 and https://github.com/tuist/xcodeproj/pull/331 by @yonaskolb and @drekka

6.0.1 - Sep 24, 2018


  • Fixes PBXProject attributes not being set properly https://github.com/tuist/xcodeproj/pull/318 by @yonaskolb.
  • Fixed remoteGlobalID typo https://github.com/tuist/xcodeproj/pull/315 by @yonaskolb.
  • Fixed XCBuildConfiguration.buildConfiguration type https://github.com/tuist/xcodeproj/pull/316 by @yonaskolb.