This project is a fork and evolution from xcproj
- Git clone the repository
- Generate xcodeproj with
swift package generate-xcodeproj.
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.
Using Swift Package Manager
Add the dependency in your
let package = Package( name: "myproject", dependencies: [ .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "6.0.0")), ], targets: [ .target( name: "myproject", dependencies: ["xcodeproj"]), ] )
Migrate to 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:
PBXObjectReferenceis an internal class now. Object references to other objects are attributes with the type of the object that is being referred. For example, a
XCConfigurationListobject has an attribute
XCBuildConfiguration. Adding a new configuration is as easy as calling
- Note that object references have different types of optionals based on the type of attribute:
PBXObjectshas also been made internal. It was exposed through the attribute
PBXProjclass. If you used to use this class for adding, removing, or getting objects, those methods have been moved to the
PBXProjclass - Public helpers
And yes, in case you are wondering, it fully supports Xcode 10 🎉
Migrate to 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:
xcprojhas been renamed to
xcodeprojso 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
RelativePathfrom the Swift Package Manager's
Basicframework. You might need to change some of the usages to use the new type.
- Reference attributes have been renamed to use the naming convention
attributeis 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.