Member-only story
Solving Swift Macro Trust Issues in Xcode Cloud Builds
Swift macros are powerful but can break your CI pipeline with trust errors. Learn how to implement a simple post-clone script that solves the “Target must be enabled” error in Xcode Cloud once and for all.
The Problem with Swift Macros in CI Environments
Swift macros, introduced in Xcode 15 with Swift 5.9, are a powerful feature that enables code generation and compile-time metaprogramming. While they offer excellent developer productivity benefits, they’ve introduced a new challenge for CI/CD pipelines, particularly in Xcode Cloud.
When you first use a macro locally, Xcode displays a dialog asking you to trust the macro’s package before it can be executed. This works fine on your development machine, but becomes problematic in automated environments like Xcode Cloud where there’s no way to click “OK” on a dialog box.
If you’ve tried to build a project using Swift macros in Xcode Cloud, you’ve likely encountered this frustrating error:
Target must be enabled before it can be used.