Ben Lancaster
02/23/2021, 3:36 PMPrimary
, has a class called Timeline
in kotlin, then this is what I see in the iOS framework header:
__attribute__((swift_name("Timeline")))
@interface ServiceManagerTimeline : ServiceManagerBase
That’s good, it means in Swift I can use a class called Timeline
.
But if I have a class in the second module, called ServiceManager-common
(a dependency of Primary
), for example, the class ClientData
in kotlin, then this is what the header has:
__attribute__((swift_name("ServiceManager_commonClientData")))
@interface ServiceManagerServiceManager_commonClientData : ServiceManagerBase
Which means in Swift I have to use ServiceManager_commonClientData
class, instead of just ClientData
.
So, looks like that the generated framework always use the second module name as a prefix for all the classes in the second module.
I guess that KM does this because to avoid a potential name collision, given that there is no concept of namespace in Swift/ObjC. However, in my case, I am sure there is no name collision.
How can I deactivate or override this behavior?
Another option I see (I tested it and it is working) is modifying the final .h file and manually modify all the swift_name
tags. Not very nice, but works.
I also tried using baseName = ""
in the second module but no luck. Any ideas or suggestions welcome.
Thanks in advance.exports
stuff on the binary