yonaskolb / XcodeGen

A Swift command line tool for generating your Xcode project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

supportedDestinations doesn't work, all platforms are displayed in Xcode

kekearif opened this issue · comments

I am trying to set my target to only support iPhone (iOS). Here is my simple setup:

name: xcodegen-demo

options:
  bundleIdPrefix: keke
  deploymentTarget:
    iOS: 16.2

targets:
  xcodegen-demo:
    type: application
    platform: iOS
    # iPad, Mac, and Apple Vision still showing in Xcode
    supportedDestinations: [iOS]
    sources:
      - path: xcodegen-demo

using supportedDestinations: [iOS] doesn't appear to work, after generating the project and opening it in Xcode I can see that all the possible destinations are still available.

Screenshot 2024-01-21 at 22 33 56

Is this a bug or am I doing something wrong?

That's Xcode's default behavior not XcodeGen's. Look at the SDK column, it's all iOS. Compare it with this:
Screenshot 2024-01-24 at 1 08 21 PM

It is indeed Xcode's default when you create a new iOS project, which is why it must have been chosen as a XcodeGen's default when this was implemented. It could be argued that it's not a great default.
To control this add these build settings to override the default template:

SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: NO
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD: NO

Let me know if that helps. Closing this for now