In the context of Introducing Spyable: A Swift Macro for Automatic Spies Generation, we encountered a similar requirement—generating peers in other targets. As per the current state of the language feature, achieving this is not feasible. Our approach aligns with that of @Logan_Shire , with the distinction that we offer greater flexibility. Rather than solely relying on the DEBUG
flag, we allow folks to define their own flags. If anyone is interested in the implementation, you can find the corresponding pull request here: Provide a flag parameter to allow limiting spyable availability by dafurman · Pull Request #64 · Matejkob/swift-spyable · GitHub