Skip to content
项目

apple/xcode-project-format

在 GitHub 查看

关于

一个用于读取、写入和操作基于 JSON 的 Xcode project.xcproj 格式的 Swift 库。

开发工具

这些数字如何统计

实测星标增长

24小时
+1
7天
+6
15天
+9
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

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

  • Swift 6.1 or later
  • macOS 14 or later (the library also builds on non-Darwin platforms; see Package.swift)

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 with Runtime Library Exception.

探索相关项目

加载中…