Skip to content

Latest commit

History

1,620 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

XcodeProj

CircleCISwift Package ManagerReleaseCode CoverageSlackLicense

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

ProjectRepository
Tuistgithub.com/tuist/tuist
Sourcerygithub.com/krzysztofzablocki/Sourcery
ProjLintgithub.com/JamitLabs/ProjLint
XcodeGengithub.com/yonaskolb/XcodeGen
xspmgitlab.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.

Installation

Swift Package Manager

Add the dependency in your Package.swift file:

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

Carthage

Only macOS

# Cartfile
github "tuist/xcodeproj"~> 7.0.0

CocoaPods

pod'xcodeproj','~> 7.0.0'

Scripting

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.0.0
import PathKit
guardCommandLine.arguments.count ==3else{letarg0=Path(CommandLine.arguments[0]).lastComponent
fputs("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.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 📚

Contributing

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

License

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

FOSSA Status

Open source

Tuist is a proud supporter of the Software Freedom Conservacy

Become a Conservancy Supporter!

About

📝 Read, update and write your Xcode projects

Resources

Code of conduct

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages