using-tuist-generated-projects by tuist/agent-skills
npx skills add https://github.com/tuist/agent-skills --skill using-tuist-generated-projects# 生成工作空间但不打开 Xcode
tuist generate --no-open
# 使用 xcodebuild 构建方案
xcodebuild build -workspace App.xcworkspace -scheme App
# 使用 xcodebuild 运行测试
xcodebuild test -workspace App.xcworkspace -scheme AppTests -only-testing AppTests/MyTestCase
使用 buildableFolders 替代 sources 和 resources 的通配符模式。可构建文件夹与文件系统保持同步,因此添加或删除文件无需重新生成。
let target = Target(
name: "App",
buildableFolders: [
"App/Sources",
"App/Resources",
]
)
使用目标标签来对项目的各个区域进行分组,例如:
tag:team:*广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
tag:feature:*tag:layer:*这些标签使得后续限定生成和测试范围变得更加容易。
带有标签的目标元数据示例:
let target = Target(
name: "PaymentsUI",
metadata: .metadata(tags: [
"tag:team:commerce",
"tag:feature:payments",
"tag:layer:ui",
])
)
当专注于某个特定区域时,仅生成所需内容:
tuist generate tag:feature:payments
tuist generate PaymentsUI PaymentsTests
保持项目与外部依赖项之间的构建配置一致。使用 PackageSettings(settings: .settings(configurations: [])) 来镜像项目配置;不匹配的情况会发出警告。
tuist generate --no-open 以避免启动 Xcode。tuist install 以解析依赖项并重试。针对生成的工作空间和方案使用 xcodebuild build。
xcodebuild build \
-workspace App.xcworkspace \
-scheme App \
-destination "generic/platform=iOS Simulator"
使用 xcodebuild test 在本地运行测试。优先使用它而不是 tuist test,因为 tuist test 每次调用都会重新生成项目,这会减慢迭代速度。
为了优化测试运行时间:
使用 --only-testing 仅运行您正在处理的特定测试套件或测试用例,而不是整个目标。
选择包含您所需测试目标但编译目标最少的方案。这可以最小化测试运行前的构建时间。
xcodebuild test
-workspace App.xcworkspace
-scheme AppTests
-only-testing AppTests/MyTestSuite
xcodebuild test
-workspace App.xcworkspace
-scheme AppTests
-only-testing AppTests/MyTestSuite/testMyFunction
buildableFolders 路径与目标的真实文件系统布局一致。buildableFolders 与 sources 或 resources 的通配符模式重叠。tuist generate --no-open 后,根据需要手动打开 Xcode。静态副作用警告: 请审慎调整产品类型。对于本地目标使用 Target.product,对于外部产品使用 PackageSettings(productTypes:)。将所有内容都设置为动态的 .framework 可以编译和运行,但可能会影响启动时间。在可能且不会引入副作用的情况下,优先使用静态产品(静态框架或库)。
Objective-C 依赖项崩溃: 根据需要在使用目标上通过 OTHER_LDFLAGS 添加 -ObjC 或 -force_load。参考:https://docs.tuist.dev/en/guides/features/projects/dependencies#objectivec-dependencies。
每周安装量
164
代码仓库
GitHub 星标数
28
首次出现
2026年2月13日
安全审计
安装于
codex148
github-copilot146
opencode145
gemini-cli143
amp143
kimi-cli142
# Generate workspace without opening Xcode
tuist generate --no-open
# Build a scheme with xcodebuild
xcodebuild build -workspace App.xcworkspace -scheme App
# Run tests with xcodebuild
xcodebuild test -workspace App.xcworkspace -scheme AppTests -only-testing AppTests/MyTestCase
Use buildableFolders instead of sources and resources globs. Buildable folders stay synchronized with the file system, so adding or removing files does not require regeneration.
let target = Target(
name: "App",
buildableFolders: [
"App/Sources",
"App/Resources",
]
)
Use target tags to group areas of the project, for example:
tag:team:*tag:feature:*tag:layer:*These tags make it easier to scope generation and testing later.
Example target metadata with tags:
let target = Target(
name: "PaymentsUI",
metadata: .metadata(tags: [
"tag:team:commerce",
"tag:feature:payments",
"tag:layer:ui",
])
)
When working on a focused area, generate only what you need:
tuist generate tag:feature:payments
tuist generate PaymentsUI PaymentsTests
Keep build configurations aligned between the project and external dependencies. Use PackageSettings(settings: .settings(configurations: [])) to mirror project configurations; mismatches emit warnings.
tuist generate --no-open in automation and scripts to avoid launching Xcode.tuist install to resolve dependencies and retry.Use xcodebuild build against the generated workspace and scheme.
xcodebuild build \
-workspace App.xcworkspace \
-scheme App \
-destination "generic/platform=iOS Simulator"
Use xcodebuild test for running tests locally. Prefer it over tuist test because tuist test regenerates the project on each invocation, which slows down iteration.
To optimize test run time:
Use--only-testing to run only the specific test suite or test case you are working on, instead of the full target.
Pick the scheme with the fewest compilation targets that still includes the test target you need. This minimizes build time before tests run.
xcodebuild test
-workspace App.xcworkspace
-scheme AppTests
-only-testing AppTests/MyTestSuite
xcodebuild test
-workspace App.xcworkspace
-scheme AppTests
-only-testing AppTests/MyTestSuite/testMyFunction
buildableFolders paths aligned to the target's real file system layout.buildableFolders with sources or resources globs in the same target.tuist generate --no-open.Static side effects warnings: adjust product types deliberately. Use Target.product for local targets and PackageSettings(productTypes:) for external products. Making everything dynamic with .framework can compile and run, but it may hurt launch time. Prefer static products (static frameworks or libraries) when possible and when they do not introduce side effects.
Objective-C dependency crashes: add -ObjC or -force_load via OTHER_LDFLAGS on consuming targets as needed. Reference: https://docs.tuist.dev/en/guides/features/projects/dependencies#objectivec-dependencies.
Weekly Installs
164
Repository
GitHub Stars
28
First Seen
Feb 13, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex148
github-copilot146
opencode145
gemini-cli143
amp143
kimi-cli142
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
33,600 周安装