XcodeGen icon indicating copy to clipboard operation
XcodeGen copied to clipboard

Deactivate the auto-generated scheme by the target

Open vicajilau opened this issue 2 years ago • 1 comments

Hello everyone,

I have a target with several schemas. I would like to disable the capability that causes a schema to be automatically created with the name of the target. Is there a way to disable this functionality to auto-generate the schema from the target?

Thank you so much!!

vicajilau avatar Aug 29 '23 11:08 vicajilau

If you're using a target's convenience scheme (i.e. TargetScheme) you can add a management section to either the target directly or, to apply to all targets, to a TargetTemplate:

# Directly in a target:
targets:
  myTarget:
 # ...
  scheme:
    management:
      isShown: false

# In a target template:
targetTemplates:
  myTemplate:
    # ...
    scheme:
      management:
        isShown: false

targets:
  myTarget:
    templates: [myTemplate]
    # ...

The scheme still exists (have a look in Xcode's Manage Schemes dialogue) but is not shown in the drop-down. You can then add custom schemes that address your targets.

One thing I've not found a way to do is to prevent generation of the default schemes completely. This seems to interfere with naming your custom scheme the same as a target: the autogenerated scheme supersedes any custom scheme:

targets:
  myTarget:
    # ...
    # autogenerated scheme still applies

schemes:
  myTarget: # <-- ignored?
    # ...

robinmacharg avatar Sep 27 '24 12:09 robinmacharg