yonaskolb / yonaskolb/XcodeGen
SwiftPM packages linked into static libraries (bug)
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 8.8k
- Forks
- 908
- Avg merge
- 17d 14h
- Merged PRs (30d)
- 2
Description
Hey! I seem to have ran into a bug with the SwiftPM package integration for static libraries. When a static library depends on an SDK (e.g. Foundation, UIKit, …) all SwiftPM packages will also be linked into it. Adding other types of dependencies doesn’t seem to have any impact. It seems like it’s only when a static library depends on both a SwiftPM package and an SDK that the issue occurs.
In my case it caused just over 3000 duplicate symbol errors. As both my app and static library target linked with Alamofire from SwiftPM 😅
I was able to reproduce with latest master. See an example using this small modification of the SPM test fixture:
name: SPM
packages:
Codability:
url: https://github.com/yonaskolb/Codability
majorVersion: 0.2.1
localPackages:
- ../../.. #XcodeGen itself
targets:
App:
type: application
platform: iOS
sources: [SPM]
scheme: {}
dependencies:
- package: Codability
- target: StaticLibrary
StaticLibrary:
type: library.static
platform: iOS
sources: StaticLibrary
dependencies:
- package: Codability
- sdk: UIKit.framework # <- the addition
Screenshot

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SPM test fixture and its modified YAML, reproducing the App and StaticLibrary targets with Codability and UIKit.framework dependencies. Trace the generated Xcode project and verify that the SwiftPM package is not linked redundantly into the static library, eliminating the duplicate symbol errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- build-system, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100