I have a KMP project for Android & iOS with a shar...
# multiplatform
g
I have a KMP project for Android & iOS with a shared umbrella module and a bunch of submodules, all with cocoapods integration. An example of dependency chain is: app -> shared umbrella module -> moduleA -> moduleB Now if moduleB declares a pod dependency towards FirebaseCrashlytics for example, I find that I have to also declare that dependency in the shared umbrella module, otherwise I get a symbol not found error when building the iOS app. Furthermore, if I run the iOS unit tests from moduleA (that imports moduleB), I also have to declare the pod dependency for Crashlytics in moduleA. Is this expected behavior? Can I somehow declare the pod dependency in moduleB and then export the module with all its pod dependencies?
a
You might be able to add "use FirebaseCrashlytics" to the module.modulemap to tell Xcode which associated frameworks are "safe" to cross-reference, without getting the cross-framework import errors. I haven't tried this, but I do use a custom modulemap in my own frameworks to acheive the same > shared umbrella module -> moduleA -> moduleB configuration.
framework module ServiceCore {
umbrella header "ServiceCore.h"
export *
module * { export * }
framework module ServiceCommon {
umbrella header "ServiceCommon.h"
export *
module * { export * }
}
link framework "UIKit"
link framework "SystemConfiguration"
link framework "CoreGraphics"
link "System"
link "sqlite3"
link "z"
use AnalyticsCommon
}
From here: https://developer.apple.com/forums/thread/42737
g
awesome. thanks. I will try it
for the record, I managed to fix this using the linkOnly flag for the pods that don't require cinterop bindings (the ones that are linked in intermediary modules). https://kotlinlang.org/docs/native-cocoapods-dsl-reference.html#pod-function