Giter Site home page Giter Site logo

xcodeproj's Introduction

XcodeProj

All Contributors

Swift Package Manager Release Code Coverage Slack 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
Tuist github.com/tuist/tuist
Sourcery github.com/krzysztofzablocki/Sourcery
ProjLint github.com/JamitLabs/ProjLint
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: "7.17.0"))
        ],
    targets: [
        .target(
            name: "myproject",
            dependencies: ["XcodeProj"]),
        ]
)

Carthage

Only macOS

# Cartfile
github "tuist/xcodeproj" ~> 7.11.

CocoaPods

pod 'xcodeproj', '~> 7.17.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.11.
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. Generate xcodeproj with swift package generate-xcodeproj.
  3. Open XcodeProj.xcodeproj.

License

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

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Joseph Colicchio

πŸ€”

deatondg

πŸ€”

Dan Fleming

πŸ’»

Sascha Schwabbauer

πŸ€”

Marcin Iwanicki

🚧

Adam Khazi

🚧

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

xcodeproj's People

Contributors

yonaskolb avatar briantkelley avatar cognitivedisson avatar dependabot-preview[bot] avatar toshi0383 avatar damirdavletov avatar ilyapuchka avatar drekka avatar llinardos avatar alvarhansen avatar kwridan avatar michaeleisel avatar ileitch avatar adamkhazi avatar fortmarek avatar marciniwanicki avatar gubikmic avatar mxcl avatar allcontributors[bot] avatar turekj avatar dangthaison91 avatar giginet avatar timbaev avatar alexruperez avatar samisuteria avatar yutomizutani avatar samskiter avatar keith avatar dflems avatar artemnovichkov avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.