- Notifications
You must be signed in to change notification settings - Fork323
📝 Read, update and write your Xcode projects
License
tuist/XcodeProj
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
XcodeProj is a library written in Swift for parsing and working with Xcode projects. It's heavily inspired byCocoaPods XcodeProj andxcode.
Project | Repository |
---|---|
ProjLint | github.com/JamitLabs/ProjLint |
rules_xcodeproj | github.com/buildbuddy-io/rules_xcodeproj |
Rugby | github.com/swiftyfinch/Rugby |
Sourcery | github.com/krzysztofzablocki/Sourcery |
Tuist | github.com/tuist/tuist |
XcodeGen | github.com/yonaskolb/XcodeGen |
xspm | gitlab.com/Pyroh/xspm |
Privacy Manifest | github.com/stelabouras/privacy-manifest |
If you are also leveraging XcodeProj in your project, feel free to open a PR to include it in the list above.
Add the dependency in yourPackage.swift
file:
letpackage=Package( name:"myproject", dependencies:[.package(url:"https://github.com/tuist/XcodeProj.git",.upToNextMajor(from:"8.12.0")),], targets:[.target( name:"myproject", dependencies:["XcodeProj"]),])
Usingswift-sh
you can automate project-tasks using scripts, for example wecan make a script that keeps a project’s version key in sync with the currentgit tag that represents the project’s version:
#!/usr/bin/swift shimport Foundationimport XcodeProj // @tuist ~> 8.8.0import PathKitguardCommandLine.arguments.count==3else{letarg0=Path(CommandLine.arguments[0]).lastComponentfputs("usage:\(arg0) <project> <new-version>\n", stderr)exit(1)}letprojectPath=Path(CommandLine.arguments[1])letnewVersion=CommandLine.arguments[2]letxcodeproj=tryXcodeProj(path: projectPath)letkey="CURRENT_PROJECT_VERSION"forconfin xcodeproj.pbxproj.buildConfigurationswhere conf.buildSettings[key]!=nil{ conf.buildSettings[key]= newVersion}try xcodeproj.write(path: projectPath)
You could then store this in your repository, for example atscripts/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 itautomatically. If so, we recommend using a library that provides aVersion
object.
- Git clone the repository
git@github.com:tuist/xcodeproj.git
. - Open
Package.swift
with Xcode.
XcodeProj is released under the MIT license.See LICENSE for details.
Thanks goes to these wonderful people (emoji key):
This project follows theall-contributors specification. Contributions of any kind welcome!
About
📝 Read, update and write your Xcode projects