https://kotlinlang.org logo
#ios
Title
# ios
a

Anthony Pages

05/31/2021, 8:51 AM
Hey everyone ! Am I the only one to have collision naming issues when generating obj-c headers ? If I have two interfaces with a same property but of different type, the compiler will add an
_
at the end of one of them in the header.
Copy code
interface A {
    val foo: Int
}
interface B {
    val foo: Int?
}
I will have the following header:
Copy code
__attribute__((swift_name("A")))
@protocol A
@required
@property (readonly) int32_t foo __attribute__((swift_name("foo"))); // <----- foo: OK
@end;

__attribute__((swift_name("B")))
@protocol B
@required
@property (readonly) KotlinInt * _Nullable foo_ __attribute__((swift_name("foo_"))); // <----- foo with an underscore: NOK
@end;
I didn't find any issue on https://youtrack.jetbrains.com/ So I ask to you here before opening one. _P.S: if props have the same type, there is no collision and no `_`_ added.
b

basher

06/01/2021, 10:55 PM
a

Anthony Pages

06/02/2021, 12:39 PM
Oh thx! I saw the linked issue you already report on github. Sad we didn't have the possibility to be able to block this mangling. something like the JsName annotation for Objc would have been great