xcode-project-format README

The project's README from github.com/apple/xcode-project-format. As one markdown file: README.md.

xcode-project-format

xcode-project-format is a Swift library for reading, writing, and manipulating Xcode's JSON-based project.xcproj format. It models the format as a rich set of value types nested under a single namespace, XCSchema, so consumers get precise, typed access to a project's structure instead of hand-parsing JSON.

The goal is to give the ecosystem a shared, accurate model of the Xcode project format — so tools like generators, linters, verifiers, and validators don't each have to reverse-engineer the format from scratch.

The package also ships xcprojformatter, a small CLI tool built on the library.

Getting started

Requirements

Installation

Add the package as a dependency in your Package.swift:

dependencies: [
    .package(url: "https://github.com/apple/xcode-project-format/", from: "0.1.0")
]

Usage

import XcodeProjectFormat

func listTargets(in projectURL: URL) throws {
    let projectData = try Data(contentsOf: projectURL)
    let project = try XCSchema.Project(jsonRepresentation: projectData)
    for target in project.targets {
        print(target.name)
    }
}

You'll find types for folders, file references, groups, targets, build phases, build rules, and the rest of the Xcode project model within this package.

Documentation

The project documentation is available at Swift Package Index.

To preview it locally:

swift package add-dependency https://github.com/swiftlang/swift-docc-plugin --from 1.5.0
swift package --disable-sandbox preview-documentation

Contributing

We welcome contributions within a defined scope. See CONTRIBUTING.md for what we accept, what's out of scope for now, and how to get started.

Support

License

Licensed under the Apache License 2.0.

xcode-project-format (apple/xcode-project-format)

Searching Database…

What is this?A Swift library from Apple for reading, writing, and manipulating Xcode's JSON-based project.xcproj format, plus a small companion CLI called 'xcprojformatter'.
Is it a library or a command-line tool?Both. The core is a library that models the project format as typed value types under one namespace, 'XCSchema', and the package also ships 'xcprojformatter', a small CLI built on that library.
How do I add it to my project?Add it as a dependency in your Package.swift via Swift Package Manager.
Which Swift and macOS versions does it need?Swift 6.1 or later and macOS 14 or later.
Who is this meant for, app developers or tool builders?Tool builders mainly: the goal is a shared, accurate model of the Xcode project format, so generators, linters, verifiers, and validators don't each have to reverse-engineer the format from scratch.
Is it Mac-only, or can I build with it on Linux too?Not strictly Mac-only: macOS 14+ is the stated requirement, but the README notes the library also builds on non-Darwin platforms; Package.swift has the specifics.
What parts of an Xcode project does the XCSchema model cover?The XCSchema types cover folders, file references, groups, targets, build phases, build rules, and the rest of the Xcode project model.
Why use this instead of parsing the project file's JSON myself?You get precise, typed access to a project's structure instead of hand-parsing raw JSON, backed by a shared, accurate model of the format.
Creator
apple
Size
0.1 MB
Stars
501
Updated
CommitOct 08
Age
1mo
Commits · 90 Days