Hi! :wave: I'm creating a wrapper for a multiplatf...
# ios
b
Hi! 👋 I'm creating a wrapper for a multiplatform dependency. Some functions of my wrapper are not available to my iOS app (those that have types in their signatures that were defined by the dependency I'm wrapping). Interestingly, these functions exist in the
shared.h
header file though. Do you have any idea how I might be able to make these functions available to my iOS App code?
1
r
By default, the only thing from your dependencies that get exported to Swift are types that are part of your Kotlin module's public API. To get more, you can explicitly export dependencies with some gradle config. See https://kotlinlang.org/docs/mpp-build-native-binaries.html#export-dependencies-to-binaries
k
I would first confirm that the iOS code fails to compile vs just xcode not auto completing
It's weird that fooMatrix isn't available if it's in the generated header.
Also, is that xcode or appcode?
m
Isn’t it because of return type
LoginFlow?
b
Thank you so much @russhwolf ! Your solution works. This got me stuck for quite a while. It now compiles and auto-completes after exporting the dependency. Pure bliss. 👌😀
👍 1
@kpgalligan Thank you for your help as well. Yes, before posting, I confirmed that I couldn't compile (not only not-auto-complete) with both Xcode and AppCode. Above in the screenshots one can see Android Studio (for Gradle / Kotlin) and AppCode (for Swift and the header file).
Also special thanks to the two of you and your colleagues at Touchlab for all the great articles and resources you contribute online. They are really helpful to get started with KMP. 👍
@Michal Harakal Thank you for responding. Yes, it was because of the return type (and its definition missing in my shared framework).
👍 1