https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
b

basher

05/24/2019, 6:54 PM
Hi! I'm trying to add a dependency to our MPP project and have everything public from that dependency exported as obj-c classes in that framework. we tried the
export
thing in
binaries.framework
, but that doesn't seem to work. Anyone else have success with this?
k

Kris Wong

05/24/2019, 7:06 PM
as far as I know that's not a supported use case. but perhaps someone from JB can chime in with an official answer.
r

russhwolf

05/24/2019, 7:23 PM
If I understand correctly, the
export
you're using is for creating a framework from your Kotlin/Native code which you can then call into from a Swift/Obj-C project. What you probably want is cinterop to be able to access an existing framework from Kotlin
k

Kris Wong

05/24/2019, 7:32 PM
I just reread the docs on the
export
keyword and I am mistaken. that's exactly it's use case. how is the dependency your using specified in your build.gradle?
s

Sam

05/24/2019, 7:39 PM
Is your dependency a binary framework or a klib? Export should work for klibs and not for binary frameworks. In macOS and iOS frameworks aren't technically supposed to depend on another framework though in practice that doesn't happen. Your iOS app should directly include any binary frameworks that your Kotlin framework depends on and it should be listed in the embedded binaries and linked frameworks sections of your target's general tab in Xcode. If you're using Cocoapods declare the same dependencies in your Podfile.
k

Kris Wong

05/24/2019, 7:47 PM
i can confirm i have taken these steps for an obj-c framework dependency declared via cinterop
however, it seems that a dependency that can be declared via
api
in the build.gradle can be exported
i haven't tried that
b

basher

05/24/2019, 8:45 PM
we're trying to do
export 'com.somegroup.project:project:version'
that style of
export
should work, right?
(it's a klib)
By specifying the build variant, it worked!
3 Views