paulb777
(Paul Beusterien)
July 1, 2020, 12:02am
1
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
paulb777
(Paul Beusterien)
July 1, 2020, 1:03am
3
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 ....
paulb777
(Paul Beusterien)
July 9, 2020, 9:12pm
4
SDGGiesbrecht:
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.
Is there a recommended way to access resources defined in a Package.swift from Objective C? I don't see anything like module
on NSBundle.
Create an Obj-C visible API to access Bundle.module
.
Karl
(đđŚ)
July 9, 2020, 10:01pm
6
Yes, the build system defines the SWIFTPM_MODULE_BUNDLE
macro to access the module bundle.
2 Likes
paulb777
(Paul Beusterien)
July 10, 2020, 1:54am
7
1 Like
Anyone finding that SWIFTPM_MODULE_BUNDLE doesn't exist in Xcode 12.5 beta?
I found that Xcode 12.5 beta doesn't support symlinked resource files (maybe because they lived outside the package root?) which caused the copy resources in the SPM package definition to not find the resource files, which makes SPM not generate the SWIFTPM_MODULE_BUNDLE macro.