Sterling Albury
02/16/2022, 9:06 AMmoduleA
and then moduleB
which has A as a dependency. moduleA
has InterfaceA
and a class that returns this type, class A { fun getInterfaceA(): InterfaceA = SomeImpl() }
, and in moduleB
, I have a class that takes this interface as a param, so class B(interfaceA: InterfaceA)
.
Now over in iOS land, I have a class Foo
with an instance of class B
like so, let var beeClass: B = B(interfaceA: interfaceA)
where interfaceA
is a member variable assigned during init, so var interfaceA: InterfaceA
and init(interfaceA: InterfaceA) { self.interfaceA = interfaceA }
.
Lastly, when I try to create in instance of Foo
with the help of an instance of class A
like so, lazy var foo: Foo = Foo(a.getInterfaceA())
,
I get complaints from xcode about the argument types not conforming to the expected types because InterfaceA
is now called AInterfaceA
. Moreover, if I go to the definition of class B
in xcode, InterfaceA
is named something like BAInterfaceA
. Casting only seems to cause the app to crash and that's what xcode is suggesting I do.
not sure if anyone followed that and has some idea what is going on. is there maybe some way to help the kotlin compiler with binding names or something? This doesn't really feel like a situation where the compiler should be changing the name of this interface and almost wonder if this could be a bugephemient
02/16/2022, 9:17 AMSterling Albury
02/16/2022, 9:25 AMGrégory Lureau
02/16/2022, 9:38 AMSterling Albury
02/16/2022, 9:47 AMSterling Albury
02/16/2022, 11:17 AMSterling Albury
02/16/2022, 7:59 PMtargets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>{
binaries.withType<org.jetbrains.kotlin.gradle.plugin.mpp.Framework>{
export(project(":moduleA"))
}
}
to my build script, the resulting framework doesn't have any prefixes derived from the module name, and my interface gets exported correctly.
https://kotlinlang.org/docs/multiplatform-build-native-binaries.html#export-dependencies-to-binaries