Finding Swift Package Manager Resources

I'm seeing that a resource bundled with Swift Package Manager is buried deep within the bundle and doesn't get found by the pathForResource API:

CoreUnit.xctest/Contents/Resources/Firebase_CoreUnit.bundle/Contents/Resources/GoogleService-Info.plist

vs

FirebaseCore-Unit-unit.xctest/GoogleService-Info.plist

for a CocoaPods resource bundle.

The call here finds the CocoaPods resource but not the Swift Package Manager resource.

What is the proper way to find SwiftPM resources? Is there a way to make the SwiftPM resource bundling compatible with CocoaPods flat bundling?

Intended access to resources works like this.

As for supporting multiple build tools side‐by‐side, this post shows roughly what you’d need to do, although it is from before some of the details were finalized, so you’ll have to mentally swap in bits from the actual finalized syntax from the other link.

1 Like

Thanks.

That doesn't seem to cover the case of injecting a resource from a test target without touching the library code itself.

I'll see what I come up with starting from your links ....

Terms of Service

Privacy Policy

Cookie Policy