manipulate-xcodeproj

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Manipulate Xcodeproj

操作Xcode项目

Overview

概述

Use
xcp
for all project edits and asset catalog operations. Install it with
brew install xcp
if it is not already available.
所有项目编辑和资源目录操作均使用
xcp
工具。如果尚未安装,可通过
brew install xcp
进行安装。

Workflow

工作流程

  1. Identify the
    .xcodeproj
    or
    .xcassets
    path.
  2. For target-specific actions, run
    xcp list-targets
    first.
  3. Run the appropriate
    xcp
    subcommand. Use
    --project-only
    to update the project file without touching the filesystem.
  4. Re-run
    xcp list-targets
    or
    xcp list-assets
    if you need to verify results.
  1. 确定
    .xcodeproj
    .xcassets
    的路径。
  2. 针对特定目标的操作,先运行
    xcp list-targets
  3. 运行相应的
    xcp
    子命令。使用
    --project-only
    参数可仅更新项目文件,而不修改文件系统。
  4. 若需验证结果,可重新运行
    xcp list-targets
    xcp list-assets

Tasks

任务

Project structure

项目结构

Use group and file subcommands to add, move, rename, or delete entries. Use
--create-groups
when adding and
--guess-target
when you want the tool to infer targets for a new file.
使用组和文件子命令来添加、移动、重命名或删除条目。添加时使用
--create-groups
参数,若希望工具自动推断新文件的目标,可使用
--guess-target
参数。

Targets and build settings

目标与构建设置

Use
list-targets
to discover names,
set-target
to update file memberships, and build-setting commands to read or update configuration values.
使用
list-targets
命令查看目标名称,
set-target
命令更新文件的目标归属,通过构建设置命令读取或更新配置值。

Asset catalogs

资源目录

Operate on
.xcassets
directories directly for image, data, and color assets. Paths are relative to the
.xcassets
root.
直接对
.xcassets
目录进行操作,处理图片、数据和颜色资源。路径为相对于
.xcassets
根目录的相对路径。

References

参考资料

  • Command and flag reference:
    references/xcp-cli.md
  • For flags and usage specifics, prefer
    xcp help <subcommand>
    as the source of truth.
  • 命令与参数参考:
    references/xcp-cli.md
  • 关于参数和使用细节,以
    xcp help <subcommand>
    作为权威来源。