yonaskolb / yonaskolb/XcodeGen

Reference Swift Package target as scheme build/target

Open
#1,425 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
8.8k
Forks
908
Avg merge
17d 14h
Merged PRs (30d)
2

Description

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!


Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the project.yml scheme build targets and the Swift package target declaration shown in the issue. Compare how XcodeGen represents package-generated targets with generated project targets, and check whether the requested UIKitV2/UIKitComponents reference can avoid duplication. Done means documenting a supported configuration or the recommended approach for avoiding the duplicate target.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift, yaml
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.