跳到正文
Skillpedia
移动应用5.9k · #14545

generated-projects

它能做什么

这项技能帮助你的 AI 在 Tuist 生成的 Xcode 工作区中工作,包括生成、构建和运行测试。适合使用 Tuist 的 iOS 和 macOS 开发者。

适用场景

  • ✓当你在 Tuist 生成的项目中工作,需要生成或构建它时。
  • ✓当你想在生成的工作区中为单个目标或测试用例运行测试时。
  • ✓当你希望整理文件夹和目标标签,让项目保持便于聚焦的时候。

技能链接

https://github.com/tuist/tuist/blob/main/skills/skills/generated-projects/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/tuist/tuist/blob/main/skills/skills/generated-projects/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请在不打开 Xcode 的情况下生成 Tuist 工作区,并运行我 payments 目标的测试。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会为工作区运行生成和构建命令,使用可构建文件夹设置让新文件被自动识别,并在需要时把生成范围限定到某个目标或标签。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Using Tuist Generated Projects

Quick Start

# 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

Project definition

Prefer buildable folders

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",
  ]
)

Tag targets for focus

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

Align build configurations

Keep build configurations aligned between the project and external dependencies. Use PackageSettings(settings: .settings(configurations: [])) to mirror project configurations; mismatches emit warnings.

Workflows

Generate intentionally

  • Use tuist generate --no-open in automation and scripts to avoid launching Xcode.
  • Regenerate when any manifest changes (or the dependency graph changes).
  • If generation fails due to missing products, run tuist install to resolve dependencies and retry.

Build with xcodebuild

Use xcodebuild build against the generated workspace and scheme.

xcodebuild build \
  -workspace App.xcworkspace \
  -scheme App \
  -destination "generic/platform=iOS Simulator"

Test with xcodebuild

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.
# Run a specific test suite
xcodebuild test \
  -workspace App.xcworkspace \
  -scheme AppTests \
  -only-testing AppTests/MyTestSuite

# Run a single test case
xcodebuild test \
  -workspace App.xcworkspace \
  -scheme AppTests \
  -only-testing AppTests/MyTestSuite/testMyFunction

Guidelines

  • Keep buildableFolders paths aligned to the target's real file system layout.
  • Avoid overlapping buildableFolders with sources or resources globs in the same target.
  • Open Xcode manually when needed after running tuist generate --no-open.

Troubleshooting

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://tuist.dev/en/docs/guides/features/projects/dependencies#objectivec-dependencies.

常见问题

添加文件后需要重新生成吗?

如果项目使用可构建文件夹,则不需要,因为它们会与文件系统保持同步。

可以只生成项目的一部分吗?

可以。你可以只生成某个标签组或指定的目标。

需要 Xcode 吗?

需要。它通过 xcodebuild 构建和测试生成的 Xcode 工作区。

详情

作者的原始描述

Guides day-to-day work in Tuist-generated Xcode workspaces, including generation, build and test commands, and buildable folders. Use when working in a Tuist-generated project or when users mention `tuist generate`, `xcodebuild test`, or generated workspaces.

repo: tuist/tuist

热度

GitHub 星标
5.9k
排名
#14545
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能