yonaskolb / XcodeGen

A Swift command line tool for generating your Xcode project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reference Swift Package target as scheme build/target

anestisKons opened this issue · comments

Hi there,

I'm currently working on creating a scheme for a Swift package using XcodeGen, and I've run into a bit of a dilemma. The Swift package generates a target, but I'm having trouble incorporating it into the scheme through the project.yml file.

Here's a snippet of my code for better context:

.target(
    name: "UIKitComponents",
    dependencies: ["UIKitTheme"],
    resources: []
),

Currently, I can create a target(throught XcodeGen) with the path of my Swift package and then use this target when creating the scheme in project.yml. However, this results in having two targets for the same Swift package in Xcode:

  1. One under the project, which I created with XcodeGen and can be referenced in the scheme creation.
  2. Another one under the package, which is created by Xcode/Package configs.

I have two questions:

  1. Is there a way to reference the target created by package in my project.yml file when creating schemes, like the example below?
schemes:
  UIKitComponents:
    build:
      targets:
        UIKitV2/UIKitComponents: all
  1. If referencing the package/target in the project.yml file is not possible, what would be the best approach to avoid ending up with two targets for the same Swift package?

Any guidance or suggestions would be greatly appreciated. Thank you!