yonaskolb / XcodeGen

A Swift command line tool for generating your Xcode project
MIT License
6.88k stars 809 forks source link

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

Closed kekearif closed 2 months ago

kekearif commented 5 months ago

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?

benadamdev commented 5 months ago

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
yonaskolb commented 2 months ago

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