another question: external C library defines a pro...
# kotlin-native
i
another question: external C library defines a protocol that KN class implements
class MyFooModule : NSObject(), FooModuleProtocol {
. But this information is erased
@interface MyFooModule : KotlinBase
in the result generated header file. How to make header file to look like this
@interface MyFooModule : KotlinBase <FooModule>
?
k
classes that inherit from Obj-C classes are unavailable in the resulting framework
__attribute__((unavailable("Kotlin subclass of Objective-C class can't be imported")))
I worked around this by creating top-level functions for working with these objects, but it makes for a bad API, so I wouldn't use it more than absolutely necessary
i
I saw that attribute generated only when inherited from
NSObject
only but if it implements some protocol and inherited from NSObject I don't get this
unavailable
attribute. The issue is that protocol is erased from the generated header.
s
There is experimental support for generics that can be turned on by adding
freeCompilerArgs.add("-Xobjc-generics")
to your framework declaration in your gradle script. Beware that Kotlin, ObjC & Swift all have different ideas about generics. There will be some use cases that aren't possible to implement easily or at all.
k
doesn't seem like this has anything to do with generics?
s
You're right. I tripped over the <> which my tired brain read as talking about generics.