Closed chrisvasselli closed 1 year ago
Never mind. I realized the package was automatically linked to my main app target, which was causing the issue. As soon as I removed that link (and only linked it to my UI test targets) this issue went away.
Ah yes, this is a little trap for testing-only packages. It is possible to select the right target in your project, but it's very easy to miss it. Very glad you figured this out so quickly.
When I added the package locally, I didn't have any trouble using it. But when I tried to add it as a dependency using SPM, I get linker errors (see below).
Per some googling, updating my own project to enable the build setting "Enable Testing Search Paths" did seem to fix the issue. But it feels like there should be a solution that doesn't require modifying a build setting on the target project.
I tried adding
swiftSettings: [.define("ENABLE_TESTING_SEARCH_PATHS")]
to Package.swift but it didn't seem to fix the issue. I also tried updating the Package.swift to addlinkerSettings: [ .linkedFramework("XCTest")]
to the UITestingPlus target, but that led to ald: framework not found XCTest
error instead.I'm not an SPM expert, so I could use some help figuring out what the appropriate solution is.