Ray_Fix
(Ray Fix)
1
I am trying to do the following in Xcode 13.3:
- Create a new iOS project called
Brain
- Add a new local package called
Cortex
- In settings for the
Brain target, under build phases add Cortex to dependencies and linked libraries.
- Use
Cortex API from within Brain and run.
At this point everything is okay. But now I try to add a dependency to Cortex by adding to Package.swift
.package(url: "https://github.com/apple/swift-collections.git", from: "1.0.2") //
At this point I get the warning:
dependency 'swift-collections' is not used by any target
Also, I don't seem to be able to import / use any API from Swift Collections from inside Cortex. (Auto complete works though.)
Is this expected behavior? What am I doing wrong? Any suggested workarounds?
Sorry for the basic question. Thanks for your help and insights.
Ray
rhx
2
You need to ensure that your Brain target actually depends on one of the swift-collections products, e.g.:
.target(
name: "Brain",
dependencies: [
.product(name: "Collections", package: "swift-collections")
]
)
1 Like
Ray_Fix
(Ray Fix)
3
Thanks for getting me unstuck! (In my case, I wanted the Cortex local package target to be able to use OrderedCollections but your hint was enough. Interestingly, the Xcode UI lets you select the Brain target but not the Cortex local package target.). Thanks again.