Swiftpack.co - tuist/XcodeProj as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by tuist.
tuist/XcodeProj 8.9.0
πŸ“ Read, update and write your Xcode projects
⭐️ 1,780
πŸ•“ 4 weeks ago
.package(url: "https://github.com/tuist/XcodeProj.git", from: "8.9.0")

XcodeProj

All Contributors

Swift Package Manager Release Code Coverage License

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


Projects Using XcodeProj

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

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:

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

Carthage

Only macOS

# Cartfile
github "tuist/xcodeproj" ~> 8.8.0

CocoaPods

pod 'xcodeproj', '~> 8.8.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 ~> 8.8.0
import PathKit

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

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

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 πŸ“š

Contributing

  1. Git clone the repository [email protected]:tuist/xcodeproj.git.
  2. Open Package.swift with Xcode.

License

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

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Joseph Colicchio
Joseph Colicchio

πŸ€”
deatondg
deatondg

πŸ€”
Dan Fleming
Dan Fleming

πŸ’»
Sascha Schwabbauer
Sascha Schwabbauer

πŸ€”
Marcin Iwanicki
Marcin Iwanicki

🚧
Adam Khazi
Adam Khazi

🚧
Elliott Williams
Elliott Williams

πŸ’»
Muukii
Muukii

πŸ–‹
Yuya Oka
Yuya Oka

πŸ’»
Keith Smiley
Keith Smiley

πŸ–‹
Ian Leitch
Ian Leitch

πŸ’»
Daniil Subbotin
Daniil Subbotin

πŸ’»
Florentin Bekier
Florentin Bekier

πŸ’»
Vadim Smal
Vadim Smal

πŸ›
freddi(Yuki Aki)
freddi(Yuki Aki)

πŸ’»
Kristopher Jackson
Kristopher Jackson

πŸ’»
Jake Prickett
Jake Prickett

πŸ’»
Jake Adams
Jake Adams

πŸ’»
matsuji
matsuji

πŸ’»
Bogdan Belogurov
Bogdan Belogurov

πŸ’»
Chuck Grindel
Chuck Grindel

πŸ’»
Michael McGuire
Michael McGuire

πŸ’»
C-凑
C-凑

πŸ’»
Maxwell Elliott
Maxwell Elliott

πŸ’»
Brentley Jones
Brentley Jones

πŸ’»
Teameh
Teameh

πŸ’»
Johannes Ebeling
Johannes Ebeling

πŸ’»
baegteun
baegteun

πŸ“–
Alex KovΓ‘cs
Alex KovΓ‘cs

πŸ“–

This project follows the all-contributors specification. Contributions of any kind welcome!

GitHub

link
Stars: 1780
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

8.9.0
5 weeks ago

Change log

Added

  • Update watchOS application default settings for Xcode 14 #711 by @kwridan
  • Implement Hashable for XCScheme.BuildableReference #712 by @cgrindel
  • Sets customWorkingDirectory for schemes #720 by @maxwellE
  • Add XCScheme.ExecutionAction.shellToInvoke #721 by @CrazyFanFan
  • Add platformFilters attribute to PBXBuildFile and PBXTargetDependency #737 by @maxwellE
  • Add suppot for XCUserData #739 by @teameh

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics