In my iOS app I am using SPM to manage dependencies. One of them is a library that loads resources with Bundle.module
(a new feature available in Swift 5.3). But now I need to use CocoaPods for my app. Hence, I should add CocoaPods support for this dependency. I know that I can copy Bundle.module
's declaration from resource_bundle_accessor.swift to the library. But it should also support SPM. I want to know how can I check if I should use Bundle.module
defined in resource_bundle_accessor.swift or my function that does the same thing if resource_bundle_accessor.swift was not generated.
One option it to use #if SWIFT_PACKAGE
to distinguish between SPM and CocoaPods specific code. Here's an example of how we set up a test to run with both package managers: https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseRemoteConfig/Tests/Unit/RCNRemoteConfigTest.m#L1144