I just ran across something odd. I have a MPP app...
# kotlin-native
s
I just ran across something odd. I have a MPP app that I'm working on that also has an MPP library. In the app's generated iOS framework I wanted to expose a property from a type in the library. Something like:
Copy code
class Exports() {
    var libraryTypeA: LibaryTypeA? = null
}
//LibraryTypeA is declared in library as extending NSOBject
class LibraryTypeA(): NSObject(): AnObjCDelegate { 
    //Some methods
}
The generated header in the app framework was exposing the type of
libraryTypeA
as NSObject and not
LibraryTypeA
. The reason I was inheriting from NSObject was because I was implementing a delegate declared in an ObjC Framework (CoreBluetooth). I'm able to work around this by encapsulating the delegate into an internal object. Is there a way to force the exported type declaration to be
LibraryTypeA
instead of
NSObject
?
o
This is well known problem, an indeed reexport like that is currently unsupported. Solution with an internal object delegate shall work, and probably is the best one at the moment.
l
@Sam I'm not seeing CoreBluetooth in autocomplete. How did you get it to work from Kotlin/Native?
s
I used ‘import platform.CoreBluetooth.*‘ but you’ll have to build to device only because Bluetooth is not available in the iOS simulator.